pub struct ToolInvocation {
pub tool_use_id: String,
pub metadata: Arc<ToolMetadata>,
pub input: Value,
pub ctx: ExecutionContext,
}Expand description
One tool call’s identifier + descriptor + input + request-scope context.
tool_use_id carries the IR’s stable id so observability layers
can correlate ToolStart / ToolComplete / ToolError events
for the same dispatch even when several parallel calls share
the same tool name. metadata is the dispatched tool’s full
declarative descriptor — name / version / effect / idempotent /
retry hint flow through the layer stack from a single source so
OtelLayer, PolicyLayer, and retry middleware see one
authoritative struct. Layers may mutate input (e.g. PII
redaction).
Fields§
§tool_use_id: StringStable tool-use id matching the originating
ContentPart::ToolUse::id. Empty when the call did not
originate from a model ToolUse block (e.g. recipe-driven
direct dispatch); observability layers fall back to
metadata.name in that case.
metadata: Arc<ToolMetadata>Full declarative descriptor of the tool being dispatched —
shared via Arc so layers don’t pay a clone per pass.
input: ValueJSON input payload.
ctx: ExecutionContextRequest-scope state.
Implementations§
Source§impl ToolInvocation
impl ToolInvocation
Sourcepub const fn new(
tool_use_id: String,
metadata: Arc<ToolMetadata>,
input: Value,
ctx: ExecutionContext,
) -> Self
pub const fn new( tool_use_id: String, metadata: Arc<ToolMetadata>, input: Value, ctx: ExecutionContext, ) -> Self
Bundle the fields.
Trait Implementations§
Source§impl Clone for ToolInvocation
impl Clone for ToolInvocation
Source§fn clone(&self) -> ToolInvocation
fn clone(&self) -> ToolInvocation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToolInvocation
impl Debug for ToolInvocation
Source§impl Retryable for ToolInvocation
impl Retryable for ToolInvocation
Source§fn ctx(&self) -> &ExecutionContext
fn ctx(&self) -> &ExecutionContext
ExecutionContext
the retry loop checks for cancellation between attempts.Source§fn ctx_mut(&mut self) -> &mut ExecutionContext
fn ctx_mut(&mut self) -> &mut ExecutionContext
RetryService can stamp an idempotency
key on first entry — every clone of the request that follows
shares the stamped key, so vendor-side dedupe sees one
logical call across N attempts.