pub trait ToolHandler: Send + Sync {
// Required method
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ToolContext,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, AppError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Handler for a single agent tool.
Implement this trait and register the handler with
ToolRegistry::register_handler.
Input validation and scope enforcement run before the handler is invoked.
Required Methods§
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ToolContext,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 ToolContext,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the tool with validated input.
Return the tool output or an AppError. Errors are redacted before
being returned over HTTP.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".