Skip to content

Fix: Normalize Mistral tool call IDs to comply with API requirements#3080

Closed
simonfr wants to merge 1 commit intoanomalyco:devfrom
simonfr:fix/mistral-tool-call-id-format
Closed

Fix: Normalize Mistral tool call IDs to comply with API requirements#3080
simonfr wants to merge 1 commit intoanomalyco:devfrom
simonfr:fix/mistral-tool-call-id-format

Conversation

@simonfr
Copy link
Copy Markdown

@simonfr simonfr commented Oct 10, 2025

Fixes #1680

Summary

This pull request addresses an incompatibility with the Mistral API's requirements for tool call IDs. The Mistral API expects tool call IDs to be exactly 9 characters long and contain onlyalphanumeric characters (a-z, A-Z, 0-9).

The previous implementation generated longer IDs with a call_ prefix, causing tool calls to fail. This change updates the ID generation logic to produce compliant IDs, ensuring thattool-dependent workflows function correctly with Mistral models.

Mistral API requires tool call IDs to be exactly 9 characters containing only [a-zA-Z0-9]. Refactored normalizeToolCallIds to accept a transform function, allowing provider-specific ID formatting.

Fixes anomalyco#1680
@lochetti
Copy link
Copy Markdown

lochetti commented Nov 7, 2025

Since #2440 was merged, I think this PR is not necessary, anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool Call ID Format Incompatible with Mistral API: "must be a-z, A-Z, 0-9, with a length of 9"

2 participants