pub trait Tool: Send + Sync {
// Required methods
fn definition(&self) -> ToolDefinition;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
arguments: Value,
context: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolCallResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Tool trait for implementing MCP tools.
Required Methods§
Sourcefn definition(&self) -> ToolDefinition
fn definition(&self) -> ToolDefinition
Get the tool definition.
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
arguments: Value,
context: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolCallResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
arguments: Value,
context: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolCallResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the tool with the given arguments.