pub trait Tool: Send + Sync {
// Required methods
fn definition(&self) -> McpTool;
fn execute<'life0, 'async_trait>(
&'life0 self,
arguments: Value,
) -> Pin<Box<dyn Future<Output = Result<CallToolResult, CallToolError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Tool trait
Defines the basic interface for MCP tools, including getting tool definition and executing the tool.
§Implementations
All tools need to implement this trait to be registered with ToolRegistry.
Required Methods§
Sourcefn definition(&self) -> McpTool
fn definition(&self) -> McpTool
Get tool definition
Returns the tool’s metadata, including name, description, parameters, etc.