pub trait Tool: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn parameters(&self) -> Value;
fn execute<'life0, 'async_trait>(
&'life0 self,
params: Value,
ctx: ToolContext,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn extension_id(&self) -> Option<&str> { ... }
}Expand description
The core trait for all tools. Implement this to add a new tool.
Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Human-readable description sent to the model.
Sourcefn parameters(&self) -> Value
fn parameters(&self) -> Value
JSON Schema for the tool’s parameters.
Provided Methods§
Sourcefn extension_id(&self) -> Option<&str>
fn extension_id(&self) -> Option<&str>
Owning extension id for tools registered by an extension. Built-in tools return None.