pub trait Tool: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn input_schema(&self) -> Value;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
input: Value,
ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn permission_level(&self) -> PermissionLevel { ... }
fn category(&self) -> ToolCategory { ... }
fn to_definition(&self) -> ToolDefinition { ... }
}Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Human-readable description shown to the model.
Sourcefn input_schema(&self) -> Value
fn input_schema(&self) -> Value
JSON Schema for the tool’s input parameters.
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
input: Value,
ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
input: Value,
ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the tool with the given JSON input.
Provided Methods§
Sourcefn permission_level(&self) -> PermissionLevel
fn permission_level(&self) -> PermissionLevel
Permission level required for this tool.
Sourcefn category(&self) -> ToolCategory
fn category(&self) -> ToolCategory
Category for grouping in tool listings.
Sourcefn to_definition(&self) -> ToolDefinition
fn to_definition(&self) -> ToolDefinition
Convert to a ToolDefinition for the provider.