pub trait Tool {
// Required method
fn call<'life0, 'async_trait>(
&'life0 self,
args: String,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn call_batch<'life0, 'async_trait>(
&'life0 self,
args: Vec<ToolCall>,
) -> Pin<Box<dyn Future<Output = Vec<ToolMessage>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A trait for tools that can be called with JSON string arguments.
Users must provide the call method. The framework auto-provides call_batch to run tools in parallel.
At runtime, different tool executors may call call or call_batch in different ways.
Users can override call_batch to customize this behavior.