pub trait AgentTool: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn parameters(&self) -> Value;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_call_id: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentToolResult, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn label(&self) -> &str { ... }
fn requires_permission(&self) -> bool { ... }
}Expand description
Tool execution trait — analog of AgentTool.execute in TS.
Required Methods§
fn name(&self) -> &str
fn description(&self) -> &str
fn parameters(&self) -> Value
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_call_id: &'life1 str,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<AgentToolResult, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
fn label(&self) -> &str
Sourcefn requires_permission(&self) -> bool
fn requires_permission(&self) -> bool
Whether the tool requires user permission by default. Read-only tools
(read, ls, grep, glob) return false; mutating or side-effecting
tools (bash, write, edit) return true.