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>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn to_definition(&self) -> ToolDefinition { ... }
}Expand description
Trait for implementing tools
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
Provided Methods§
Sourcefn to_definition(&self) -> ToolDefinition
fn to_definition(&self) -> ToolDefinition
Convert to ToolDefinition