Trait Tool

Source
pub trait Tool: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn description(&self) -> &str;
    fn parameters_schema(&self) -> Value;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        args: Value,
        ctx: ToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Tool trait for implementing various tools

Required Methods§

Source

fn id(&self) -> &str

Unique identifier for the tool

Source

fn description(&self) -> &str

Human-readable description of the tool

Source

fn parameters_schema(&self) -> Value

JSON Schema for the tool’s parameters

Source

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

Execute the tool with given parameters and context

Implementors§