Tool

Trait Tool 

Source
pub trait Tool: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn input_schema(&self) -> Value;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: Value,
        context: &'life1 ExecutionContext,
    ) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn definition(&self) -> ToolDefinition { ... }
}
Expand description

Core tool trait for all tool implementations.

Required Methods§

Source

fn name(&self) -> &str

Source

fn description(&self) -> &str

Source

fn input_schema(&self) -> Value

Source

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

Provided Methods§

Implementors§

Source§

impl Tool for McpToolWrapper

Source§

impl<T: SchemaTool + 'static> Tool for T