Skip to main content

ToolHandler

Trait ToolHandler 

Source
pub trait ToolHandler: Send + Sync {
    // Required method
    fn call<'life0, 'async_trait>(
        &'life0 self,
        arguments: HashMap<String, Value>,
    ) -> Pin<Box<dyn Future<Output = McpResult<ToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for implementing tool handlers

Required Methods§

Source

fn call<'life0, 'async_trait>( &'life0 self, arguments: HashMap<String, Value>, ) -> Pin<Box<dyn Future<Output = McpResult<ToolResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the tool with the given arguments

§Arguments
  • arguments - Tool arguments as key-value pairs
§Returns

Result containing the tool execution result or an error

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§