Tool

Trait Tool 

Source
pub trait Tool: Send + Sync {
    // Required methods
    fn definition(&self) -> ToolDefinition;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn name(&self) -> String { ... }
}
Expand description

Trait for all MCP tools

Required Methods§

Source

fn definition(&self) -> ToolDefinition

Get the tool definition

Source

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

Execute the tool

Provided Methods§

Source

fn name(&self) -> String

Get the tool name

Implementors§