Skip to main content

Tool

Trait Tool 

Source
pub trait Tool: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn input_schema(&self) -> JsonValue;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        params: HashMap<String, JsonValue>,
    ) -> Pin<Box<dyn Future<Output = ToolExecutionResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Tool trait that all tools must implement

Required Methods§

Source

fn name(&self) -> &str

Unique name for this tool

Source

fn description(&self) -> &str

Human-readable description for LLM

Source

fn input_schema(&self) -> JsonValue

JSON schema for input parameters

Source

fn execute<'life0, 'async_trait>( &'life0 self, params: HashMap<String, JsonValue>, ) -> Pin<Box<dyn Future<Output = ToolExecutionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the tool with given parameters

Implementors§