pub trait StaticToolExecute:
Send
+ Sync
+ 'static {
// Required method
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
call: ToolCall<'life1>,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided method
fn prepare_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
pending: PendingToolCall,
_context: &'life1 ToolPrepareContext,
) -> Pin<Box<dyn Future<Output = Result<PreparedToolCall, ToolResult>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
}Expand description
Author a fixed-tool provider without hand-rolling tool_manifests /
resolve_contract: supply the ToolDefinitions once and an
StaticToolExecute for behavior.
Per-call execution behavior for a StaticToolProvider.
Implement this on the struct that owns the tool’s runtime state (HTTP
clients, shared mutable state, configuration flags, …). The provider’s
manifests and contracts come from the ToolDefinitions passed to
StaticToolProvider::new; this trait supplies only the dynamic behavior.
Required Methods§
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
call: ToolCall<'life1>,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
call: ToolCall<'life1>,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Execute a resolved tool call. Dispatch on call.name when serving more
than one tool.
Provided Methods§
Sourcefn prepare_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
pending: PendingToolCall,
_context: &'life1 ToolPrepareContext,
) -> Pin<Box<dyn Future<Output = Result<PreparedToolCall, ToolResult>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn prepare_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
pending: PendingToolCall,
_context: &'life1 ToolPrepareContext,
) -> Pin<Box<dyn Future<Output = Result<PreparedToolCall, ToolResult>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Optional argument-preparation hook, mirroring
ToolProvider::prepare_tool_call. Defaults to the identity transform.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".