# language_models: Fix Mistral tool use erroring out \(\#54058\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/bbf087756c51aa1d22cbc08148b6506b06ca7b30)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: bbf087756c51aa1d22cbc08148b6506b06ca7b30

Requested commit: bbf087756c51aa1d22cbc08148b6506b06ca7b30

Commit: bbf087756c51aa1d22cbc08148b6506b06ca7b30

Tree: 3c3cc1eef6d3fa276a8e7e6943e83900b757973d

Author: Smit Barmase

Committer: GitHub

## Message

```
language_models: Fix Mistral tool use erroring out (#54058)

Closes #52717

Mistral's streaming API sometimes sends `"id": "null"` (the literal
string, not JSON null) in continuation chunks for tool calls. Our stream
handler treated this as a valid ID, overwriting the real tool call ID
from the first chunk. When the corrupted ID was sent back in the next
request, Mistral's API rejected it with "Tool call id has to be defined
in serving mode."

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed issue where Mistral models erroring out with "Tool call id has
to be defined" when using tools.
```

## Parents

- [053803099b5680089333af05c8be5841dad65deb](https://git.cafe/gitcafe/zed/commit/053803099b5680089333af05c8be5841dad65deb?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/bbf087756c51aa1d22cbc08148b6506b06ca7b30?format=markdown)
