Skip to main content

ToolHandler

Trait ToolHandler 

Source
pub trait ToolHandler:
    Send
    + Sync
    + 'static {
    // Required methods
    fn list(&self) -> Pin<Box<dyn Future<Output = Vec<ToolDef>> + Send + '_>>;
    fn call(
        &self,
        name: &str,
        args: &[u8],
        metadata: HashMap<String, String>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + '_>>;
}
Expand description

Tool handler trait

Implement this trait to handle tool operations.

Required Methods§

Source

fn list(&self) -> Pin<Box<dyn Future<Output = Vec<ToolDef>> + Send + '_>>

List available tools

Source

fn call( &self, name: &str, args: &[u8], metadata: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>> + Send + '_>>

Call a tool

Implementors§