Trait ToolHandler

Source
pub trait ToolHandler {
    // Required method
    fn execute(
        &self,
        arguments: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + '_>>;

    // Provided methods
    fn validate(&self, arguments: &Value) -> Result<()> { ... }
    fn get_requirements(&self) -> ToolRequirements { ... }
}
Expand description

Tool handler trait

Required Methods§

Source

fn execute( &self, arguments: Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + '_>>

Execute the tool with given arguments

Provided Methods§

Source

fn validate(&self, arguments: &Value) -> Result<()>

Validate tool arguments

Source

fn get_requirements(&self) -> ToolRequirements

Get tool resource requirements

Implementors§

Source§

impl<F, Fut> ToolHandler for FunctionToolHandler<F>
where F: Fn(Value) -> Fut + Send + Sync, Fut: Future<Output = Result<Value>> + Send + 'static,