Tool

Trait Tool 

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

    // Provided methods
    fn requires_confirmation(&self) -> bool { ... }
    fn examples(&self) -> Vec<ToolExample> { ... }
}
Expand description

Trait for all tools

Required Methods§

Source

fn name(&self) -> &str

Get the name of the tool

Source

fn description(&self) -> &str

Get the description of the tool

Source

fn parameters_schema(&self) -> Value

Get the JSON schema for the tool’s parameters

Source

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

Execute the tool with the given parameters

Provided Methods§

Source

fn requires_confirmation(&self) -> bool

Check if the tool requires special permissions

Source

fn examples(&self) -> Vec<ToolExample>

Get examples of how to use this tool

Implementors§