pub trait TypedTool:
Send
+ Sync
+ 'static {
type Args: DeserializeOwned + JsonSchema;
// Required methods
fn name(&self) -> &str;
fn description(&self) -> &str;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Self::Args,
ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolOutput> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn parallel_safe(&self) -> bool { ... }
fn mutating(&self) -> bool { ... }
}Required Associated Types§
type Args: DeserializeOwned + JsonSchema
Required Methods§
fn name(&self) -> &str
fn description(&self) -> &str
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Self::Args,
ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = ToolOutput> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
Sourcefn parallel_safe(&self) -> bool
fn parallel_safe(&self) -> bool
Whether this tool may run concurrently with other calls in the same
batch. Default false — a tool opts in, so anything that mutates state
is a barrier unless it explicitly claims otherwise.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".