Trait ToolHandler

Source
pub trait ToolHandler:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn schema(&self) -> Value;
    fn call<'life0, 'async_trait>(
        &'life0 self,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = ToolResult<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for implementing MCP tools

Required Methods§

Source

fn name(&self) -> &'static str

The name of the tool

Source

fn description(&self) -> &'static str

A description of what the tool does

Source

fn schema(&self) -> Value

JSON schema describing the tool’s parameters

Source

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

Execute the tool with the given parameters

Implementors§