pub trait Tool: Send + Sync {
// Required methods
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
// Provided method
fn validate_args(&self, _args: &Value) -> Result<()> { ... }
}
Expand description
Core trait for all agent tools
Required Methods§
Sourcefn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool with given arguments
Sourcefn description(&self) -> &'static str
fn description(&self) -> &'static str
Get the tool’s description
Provided Methods§
Sourcefn validate_args(&self, _args: &Value) -> Result<()>
fn validate_args(&self, _args: &Value) -> Result<()>
Validate arguments before execution