Skip to main content

ToolHandler

Trait ToolHandler 

Source
pub trait ToolHandler: Send + Sync {
    // Required methods
    fn definition(&self) -> McpTool;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        arguments: Value,
    ) -> Pin<Box<dyn Future<Output = Result<CallToolResult, McpError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Handler for a single tool

Required Methods§

Source

fn definition(&self) -> McpTool

Get the tool definition

Source

fn execute<'life0, 'async_trait>( &'life0 self, arguments: Value, ) -> Pin<Box<dyn Future<Output = Result<CallToolResult, McpError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the tool

Implementors§

Source§

impl ToolHandler for AgentMcpHandler

Source§

impl ToolHandler for CrewMcpHandler

Source§

impl ToolHandler for GraphMcpHandler

Source§

impl<F> ToolHandler for FnTool<F>
where F: Fn(Value) -> Result<Value, String> + Send + Sync + 'static,

Source§

impl<F, Fut> ToolHandler for AsyncFnTool<F, Fut>
where F: Fn(Value) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Value, String>> + Send + 'static,