pub trait Tool: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn definition(&self) -> ToolDefinition;
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn ephemeral(&self) -> EphemeralConfig { ... }
}Expand description
Trait for defining tools that can be called by an LLM
Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Get the tool description
Sourcefn definition(&self) -> ToolDefinition
fn definition(&self) -> ToolDefinition
Get the tool definition (JSON Schema)
Provided Methods§
Sourcefn ephemeral(&self) -> EphemeralConfig
fn ephemeral(&self) -> EphemeralConfig
Whether tool outputs should be ephemeral (removed from context after use)