pub trait Tool: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
fn parameters(&self) -> Vec<ToolParameter>;
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult<ToolCallResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn to_function_define(&self) -> ToolDefinition { ... }
}Required Methods§
fn name(&self) -> &'static str
fn description(&self) -> &'static str
fn parameters(&self) -> Vec<ToolParameter>
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult<ToolCallResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provided Methods§
fn to_function_define(&self) -> ToolDefinition
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".