pub trait Tool: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn definition(&self) -> ToolDefinition;
fn execute<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn required_capability(&self) -> Capability;
// Provided method
fn timeout(&self) -> Duration { ... }
}Expand description
Executable tool with capability enforcement.
Required Methods§
Sourcefn definition(&self) -> ToolDefinition
fn definition(&self) -> ToolDefinition
JSON Schema definition for the LLM.
Sourcefn execute<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
input: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool with JSON input.
Sourcefn required_capability(&self) -> Capability
fn required_capability(&self) -> Capability
Required capability to invoke this tool (Poka-Yoke).