Bind Mistral tool_choice to the Authenticated Route
Mistral tool_choice can allow no tool, let the model decide, require one or more calls, or force a named function. That field changes the execution path of an agent and should be selected by a server-owned route policy rather than caller input. This guide maps each mode to an authenticated operation, validates the selected tools and records the final decision before execution.

Mistral exposes tool_choice with four named modes and a specific-function selector. The Chat Completion API defines none, auto, any or required, plus a named tool object that forces one function. This field changes an application from text generation into a tool-selection path. The authenticated route should own that choice.
Allowing a browser client to choose required is the kind of convenience a security committee should delete.
TL;DR
- Resolve Mistral
tool_choicefrom the authenticated route, role, operation and approved tool set. - Use
nonefor text-only routes,autofor reviewed optional-tool workflows, and a named function only for narrowly defined operations. - Validate every returned function name and argument object before execution, even when the request forced that function.
- Record the requested and resolved modes, offered tools, selected function, argument decision and execution outcome.
Each mode changes the execution contract
The Mistral function-calling guide describes auto as model choice, any as forced tool use and none as prevention of tool use. The API also accepts required and a named function selector. These choices deserve separate route policies.
A report-writing endpoint can set none and reject every caller attempt to supply tools. For a support assistant, auto can expose two read-only functions whose arguments receive deterministic checks. An invoice-only route can force the named lookup function, provided the authenticated caller is authorized for the account. required or any broadens the model's duty to choose a tool, so the offered set must be small and reviewed.
The AI tool-call policy guide covers authorization after selection. tool_choice determines the allowed selection mode. Authorization decides whether the proposed call may run for this identity and object.
A server-owned manifest resolves the field
Store the chosen mode in a route manifest with the exact Mistral model, approved tool definitions, authenticated roles, argument schema versions, maximum call budget and active policy version. Build the provider request from that manifest. Preserve any caller-supplied tool_choice value as evidence, then reject or discard it according to the route contract.
The named-function selector needs an exact match against the deployed tool registry. Never normalize a mismatch silently. A misspelled function, stale alias or duplicate name should fail before the request reaches Mistral. For auto, any and required, compare the complete offered tool set with the manifest, including descriptions and parameter schemas. A changed description can alter model selection even when the function name stays put.
On the operator screen, put the resolved mode in a blue capsule beside the route name. List offered functions below it and strike through any caller-supplied extra in red. That small visual catches more drift than a generic "agent enabled" label.
Returned calls need independent validation
Mistral's five-step function-calling flow places execution in developer code after the model returns function arguments. Keep that execution boundary explicit in the implementation. The model proposes a function call. The application validates the function name, parses the arguments, checks the argument schema, authorizes referenced objects and executes only after approval.
For a payment lookup, a valid transaction_id still needs an ownership check against the authenticated account. For an update tool, verify current workflow state and the caller's role. Free-text arguments need length and data-policy checks before they enter another system. A forced named function reduces selection ambiguity but grants no authority over its arguments.
The agent authorization guide supplies the identity side of this decision. The tool executor should receive a short-lived authorization result tied to one tool call, not the agent's ambient service credential.
Release tests cover every mode
Run the test matrix against the final serialized request and the production tool registry. Start with one approved case per route, then introduce controlled failures.
- Send tools to a route resolved as
none. - Ask for
requiredwhere the manifest permits onlyauto. - Force a function absent from the route registry.
- Change one tool description without changing its name.
- Return an unoffered function name.
- Return malformed or extra arguments for an offered function.
- Reference an object owned by another tenant.
- Exceed the route's maximum tool-call budget.
Assert zero tool executions for every rejected case. Record the incoming and resolved mode, offered-tool digest, model, proposed function, argument-validator result, authorization outcome, provider response identifier and execution receipt. The per-decision audit record guide explains why that record should sit outside the agent's own write path.
DeepInspect
DeepInspect can enforce tool_choice and offered-tool policy on authenticated HTTP requests deliberately routed through its proxy to Mistral. It can reject unauthorized overrides before egress and write the route decision beside the identity, model, tool-set digest and policy version.
Application teams own tool implementation, argument validation and downstream authorization. Mistral determines provider-side model selection behavior. Local execution, direct provider calls and tool traffic that bypasses the proxy remain outside DeepInspect's enforcement boundary.
Book a technical deep dive at deepinspect.ai.
Frequently asked questions
- Is auto safe for every tool-enabled route?
autogives the model discretion to answer directly or propose one or more offered tools. Its safety depends on the offered set and the authorization performed after selection. Keep the tool set narrow, validate arguments and require a separate policy decision before any side effect.- What is the difference between any and a named tool?
anyorrequiredmakes tool use mandatory while leaving selection among the offered tools to the model. A named selector forces one function. Both still require argument validation and object-level authorization before execution.- Should caller overrides be ignored or rejected?
A strict route can reject the request because the override signals contract drift. Another route may discard the untrusted field and insert the manifest value. Pick one behavior, test it and record both values. Silent pass-through leaves execution policy in caller input.
- What belongs in the tool decision record?
Capture the authenticated identity supplied by the application, route, requested and resolved
tool_choice, model, offered-tool digest, selected function, argument digest, validator outcome, authorization result, execution status and timestamps. Preserve provider and downstream correlation identifiers when those calls occur.