pub trait Tool: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn parameters_schema(&self) -> Value;
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, AppError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
}Expand description
Trait for implementing tools that agents can invoke.
Tools provide specific capabilities to agents, such as calculations, web searches, or API calls.
Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Returns a description of what this tool does.
Sourcefn parameters_schema(&self) -> Value
fn parameters_schema(&self) -> Value
Returns the JSON schema for this tool’s parameters.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".