ToolInvoker

Trait ToolInvoker 

Source
pub trait ToolInvoker: Send + Sync {
    // Required methods
    fn invoke<'life0, 'async_trait>(
        &'life0 self,
        input: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn metadata(&self) -> ToolMetadata;
}
Expand description

Tool invocation interface

This trait defines the interface for invoking tools. Implementations handle the actual tool execution and result formatting.

Required Methods§

Source

fn invoke<'life0, 'async_trait>( &'life0 self, input: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invoke the tool with the given input

§Arguments
  • input - The input to the tool as JSON
§Returns

The tool output as JSON or an error

Source

fn metadata(&self) -> ToolMetadata

Get metadata about this tool

Implementors§