pub struct ToolCall {
pub id: ToolCallId,
pub provider: Option<ProviderCallId>,
pub function: ToolFunction,
pub signature: Option<String>,
pub additional_params: Option<Value>,
}Expand description
Describes a tool call with an id and function to call, generally produced by a provider.
Fields§
§id: ToolCallIdRig’s correlation handle. Always present; minted when the provider issued none.
provider: Option<ProviderCallId>What the provider issued, if anything — the only identifiers that
may go back on the wire as that provider’s handles. None means
the provider issued no id (id-less wires such as Gemini REST or
older Ollama daemons).
function: ToolFunctionFunction name and JSON arguments requested by the model.
signature: Option<String>Optional cryptographic signature for the tool call.
This field is used by some providers (e.g., Google) to provide a signature that can verify the authenticity and integrity of the tool call. When present, it allows verification that the tool call was actually generated by the model and has not been tampered with.
This is an optional, provider-specific feature and will be None for providers
that don’t support tool call signatures.
additional_params: Option<Value>Additional provider-specific parameters to be sent to the completion model provider
Implementations§
Source§impl ToolCall
impl ToolCall
Sourcepub fn new(id: ToolCallId, function: ToolFunction) -> ToolCall
pub fn new(id: ToolCallId, function: ToolFunction) -> ToolCall
A call with an explicit correlation handle and no provider-issued id.
Sourcepub fn from_wire(wire_id: impl Into<String>, function: ToolFunction) -> ToolCall
pub fn from_wire(wire_id: impl Into<String>, function: ToolFunction) -> ToolCall
The single-identifier provider boundary: adopt the wire’s id when it issued one, mint when it did not (empty or absent ids mint).
Sourcepub fn from_dual_wire(
item_id: impl Into<String>,
call_id: impl Into<String>,
function: ToolFunction,
) -> ToolCall
pub fn from_dual_wire( item_id: impl Into<String>, call_id: impl Into<String>, function: ToolFunction, ) -> ToolCall
The dual-identifier provider boundary (OpenAI Responses): item_id
is the output-item handle (fc_…), call_id the correlator
(call_…). The correlator drives rig’s id; empty ids mint.
Sourcepub fn with_provider(self, provider: ProviderCallId) -> ToolCall
pub fn with_provider(self, provider: ProviderCallId) -> ToolCall
Attach provider-issued identifiers.
Sourcepub fn wire_call_id(&self) -> &str
pub fn wire_call_id(&self) -> &str
The identifier for a wire whose call-id slot is required: the
provider-issued call_id when the provider issued one, else rig’s
minted handle — always non-empty.
Wires whose id slot is optional (Gemini REST, gRPC) must read
ToolCall::provider directly instead: minted handles never travel
upstream there.