pub trait Tool: Send + Sync {
// Required methods
fn schema(&self) -> ToolSchema;
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
ctx: ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Core trait for tool implementations
Required Methods§
Sourcefn schema(&self) -> ToolSchema
fn schema(&self) -> ToolSchema
Returns the schema definition for this tool
Sourcefn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
ctx: ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
ctx: ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes the tool with the given arguments and context