Correlate Every Mistral Function Call with Its Tool Result
Mistral returns an ID with each proposed function call, and the developer sends that ID back as tool_call_id with the result. Production systems should bind the identifier to one conversation, model response, authenticated principal and approved execution. Reject unknown, replayed or cross-tenant IDs, and preserve the chain through the final assistant response.

A Mistral function call carries an ID. The tool result sent back to the model carries that value as tool_call_id. The Mistral function-calling guide shows the ID copied from the assistant's proposed call into the tool-role message. That link is the join key for one model proposal and one execution result. Treating it as a loose string invites crossed results and replay.
I want this identifier handled like a transaction reference. Copying it through three queues on trust is reckless.
TL;DR
- Bind each Mistral function-call ID to one provider response, conversation, authenticated principal, function and argument digest.
- Accept a tool result only after the call was authorized and executed under that binding.
- Reject unknown, duplicate, expired, cross-conversation and cross-tenant
tool_call_idvalues before sending another model request. - Preserve the complete chain through the final assistant response, including blocked and failed calls.
The ID joins proposal and result
The Chat Completion API reference defines tool calls with an ID, function name and arguments, while tool-role messages return that value through tool_call_id.
Create a server-side call record as soon as the assistant response arrives. Store the provider response identifier, conversation or workflow identifier, authenticated principal, route, model, function name, canonical argument digest, tool-call ID, authorization state and expiry. The browser or agent runtime can reference that record, while the server-side record remains the source of truth for the binding.
The AI audit log schema guide supplies the parent request fields. The function-call record becomes a child artifact linked through a stable enterprise request ID.
Authorization attaches before execution
Parse the proposed arguments and validate them against the deployed function schema, then check the function, referenced object and requested action against the authenticated identity. Only an authorized call moves into execution state. Store the decision before invoking the downstream tool.
When the result returns, require an exact match on the server-side record. Confirm the call is awaiting a result, the principal and conversation still match, the function execution produced the result, and the identifier remains active and unconsumed. An unknown ID enters a security event path and stops before the follow-up Mistral request.
A 20-character identifier on a white queue card looks harmless. Put the function name, tenant and status beside it. The wrong tenant in red is immediately visible. A bare identifier would pass an operator's glance.
The AI agent authorization guide explains the per-action decision. Correlation proves which approved action produced the returned result.
State transitions prevent replay
Use explicit states such as proposed, denied, approved, executing, completed, failed, expired and consumed. Define allowed transitions and make the update atomic. A completed result can be sent to the model once under the original workflow. Depending on the tool's idempotency design, a retry should reference the existing execution receipt or create a new call record under a new model proposal.
Parallel function calling makes this discipline more important because several IDs remain active at once. Preserve ordering only where the provider protocol needs it. Match by ID rather than list position, function name or arrival time, since two calls to the same function can target different customer records.
After the follow-up Mistral response arrives, link it to the exact set of tool result records included in the request. That chain should survive independently of the agent process, as the tamper-evident audit log guide explains.
Negative tests target crossed results
Build the acceptance suite around one valid function-calling exchange. Then alter the identifier and binding conditions.
- Return a result with an unknown
tool_call_id. - Reuse a completed ID in a second turn.
- Swap IDs between two parallel calls.
- Attach a result from another authenticated tenant.
- Change the function name while preserving the ID.
- Modify arguments after authorization and before execution.
- Deliver two results concurrently for one call.
- Send a result after the call record expires.
Assert that every invalid case produces zero follow-up calls to Mistral and no duplicate downstream side effect. Record the rejection reason, supplied ID, expected binding, current state and timestamp. Avoid logging sensitive tool output in an unrestricted event stream. Preserve it under the route's data-retention policy.
DeepInspect
DeepInspect can attach authenticated route and policy context to Mistral HTTP exchanges deliberately routed through its proxy. It can record the provider response, proposed function-call identifier and follow-up decision. Investigators can then trace the model-side chain.
Application teams own tool-call state, downstream execution, object authorization and replay prevention. Mistral defines the provider-side protocol. Local tools and traffic that bypasses the proxy remain outside DeepInspect's enforcement boundary.
Book a technical deep dive at deepinspect.ai.
Frequently asked questions
- Is tool_call_id an authorization token?
The identifier correlates a proposed call with a result. Authorization still needs the authenticated identity, function, arguments, target object and active policy. Preserve the provider's identifier exactly. Every permission comes from the separate authorization decision.
- Can IDs be reused after a retry?
A transport retry for the same idempotent execution may reuse the server-side record under a documented retry path. A fresh model proposal should create a fresh binding. Mark consumed results. Reject any later tool message carrying the old ID.
- What happens when parallel results arrive out of order?
Match each result to its call record by ID, and store arrival and completion times independently. Construct the follow-up message according to the provider protocol after all required results or terminal failures are known.
- How long should the binding live?
Keep the active acceptance window as short as the tool workflow permits. Retain the completed evidence according to the audit and data-retention policy. Expiry should stop new result submission while preserving the historical record.