pub trait Tool: Send + Sync {
// Required methods
fn definition(&self) -> ToolDefinition;
fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ToolCallContext,
control: &'life2 CallControl,
store: Option<&'life3 dyn ArtifactStore>,
) -> Pin<Box<dyn Future<Output = ToolResultPayload> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
}Expand description
The tool port: one callable tool the model can invoke. Implementations live outside the kernel; the driver’s executor dispatches them. A tool returns only its recorded result. Handling unknown outcomes and retaining output belong to the execution consumer, not tool declarations.
Required Methods§
Sourcefn definition(&self) -> ToolDefinition
fn definition(&self) -> ToolDefinition
The model-facing ToolDefinition for this tool.
Sourcefn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ToolCallContext,
control: &'life2 CallControl,
store: Option<&'life3 dyn ArtifactStore>,
) -> Pin<Box<dyn Future<Output = ToolResultPayload> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ToolCallContext,
control: &'life2 CallControl,
store: Option<&'life3 dyn ArtifactStore>,
) -> Pin<Box<dyn Future<Output = ToolResultPayload> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Runs one call under the call’s CallControl, returning the
recorded result. store is the host’s ArtifactStore when one is
configured: a tool that produces media or oversized output persists
the bytes there and returns a reference; a tool that does not need
storage ignores it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".