pub trait Tool: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn schema(&self) -> Value;
fn risk(&self) -> RiskLevel;
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Value,
ctx: &'life1 ToolCtx,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn metadata(&self) -> ToolMetadata { ... }
}Expand description
What an agent can do. Every tool declares a JSON schema and a risk level used by the autonomy gate.
Required Methods§
fn name(&self) -> &str
fn description(&self) -> &str
fn schema(&self) -> Value
fn risk(&self) -> RiskLevel
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Value,
ctx: &'life1 ToolCtx,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
fn metadata(&self) -> ToolMetadata
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".