Skip to main content

McpTool

Trait McpTool 

Source
pub trait McpTool:
    'static
    + Send
    + Sync {
    // Required methods
    fn definition(&self) -> McpToolDefinition;
    fn invoke(
        &self,
        call: &McpToolCall,
        arguments: Value,
    ) -> Result<McpToolResult, McpToolError>;
}
Expand description

A tool with a hand-written input schema that receives its arguments as JSON.

Required Methods§

Source

fn definition(&self) -> McpToolDefinition

Source

fn invoke( &self, call: &McpToolCall, arguments: Value, ) -> Result<McpToolResult, McpToolError>

Called on an arbitrary thread. An error produces an error result. Under panic = "unwind" a panic produces an internal_error result, and under panic = "abort" it ends the process.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§