pub trait Tool: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
fn call<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, SynapticError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn parameters(&self) -> Option<Value> { ... }
fn as_tool_definition(&self) -> ToolDefinition { ... }
}Expand description
Defines an executable tool that can be called by an AI model. Each tool has a name, description, JSON schema for parameters, and an async call() method.
Required Methods§
fn name(&self) -> &'static str
fn description(&self) -> &'static str
fn call<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provided Methods§
fn parameters(&self) -> Option<Value>
fn as_tool_definition(&self) -> ToolDefinition
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".