# Tool call issue with GLM-4.5-Air

**URL:** https://discuss.vllm.ai/t/tool-call-issue-with-glm-4-5-air/1254
**Category:** General
**Created:** [July 31, 2025, 8:37am UTC](https://discuss.vllm.ai/t/tool-call-issue-with-glm-4-5-air/1254 "2025-07-31T08:37:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![adonishong](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@adonishong](https://discuss.vllm.ai/u/adonishong)
#### Post date: [July 31, 2025, 8:37am UTC](https://discuss.vllm.ai/t/tool-call-issue-with-glm-4-5-air/1254/1 "2025-07-31T08:37:11Z")

</div>

Highly appreciate for your work, your guys work is fantastic!

We are using the latest version of vllm installed via pip to deploy GLM-4.5-Air inference to provide inference services for the Claude Code frontend. Normal conversations work fine, but once tool calls are involved, problems occur. We can see errors like the following:

"  
tool call info TodoWrite  
ERROR 07-31 08:23:37 [glm4\_moe\_tool\_parser.py:402] Error trying to handle streaming tool call.  
ERROR 07-31 08:23:37 [glm4\_moe\_tool\_parser.py:402] Traceback (most recent call last):  
ERROR 07-31 08:23:37 [glm4\_moe\_tool\_parser.py:402] File “/home/xxx/anaconda3/envs/py311ktransqwen3/lib/python3.11/site-packages/vllm/entrypoints/openai/tool\_parsers/glm4\_moe\_tool\_parser.py”, line 272, in extract\_tool\_calls\_streaming  
ERROR 07-31 08:23:37 [glm4\_moe\_tool\_parser.py:402] tool\_name = tool\_id.split(‘.’)[1].split(‘:’)[0]  
ERROR 07-31 08:23:37 [glm4\_moe\_tool\_parser.py:402] ~~~~~~~~~~~~~~~~~~ ^^^  
ERROR 07-31 08:23:37 [glm4\_moe\_tool\_parser.py:402] IndexError: list index out of range  
"

”tool call info TodoWrite” comes from my print to console code after glm4\_moe\_tool\_parser.py:402 to check out the tool\_id info

This is my startup command:

"  
export CONTEXT\_LENGTH=131072; vllm serve ./GLM-4.5-Air-GPTQ-Int4-Int8Mix --served-model-name GLM-4.5-Air --enable-expert-parallel --max-num-seqs 32 --max-model-len $CONTEXT\_LENGTH --trust-remote-code --tensor-parallel-size 8 --host 0.0.0.0 --port 8000 --enable-auto-tool-choice --tool-call-parser glm4\_moe --reasoning-parser glm4\_moe --gpu-memory-utilization 0.9  
"

---

<div class="post-metadata">

### Author: ![RunLLM](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.vllm.ai/runllm/32/233_2.png) [@RunLLM](https://discuss.vllm.ai/u/RunLLM)
#### Post date: [July 31, 2025, 8:37am UTC](https://discuss.vllm.ai/t/tool-call-issue-with-glm-4-5-air/1254/2 "2025-07-31T08:37:58Z")

</div>

Thank you for your feedback! The error `IndexError: list index out of range` in `glm4_moe_tool_parser.py` occurs when the code tries to split `tool_id` by `.` and access the second element, but the split result is too short. This suggests that the tool call output from the model does not match the expected format (e.g., `tool_id` is missing a `.` or is malformed). According to [glm4\_moe\_tool\_parser.py](https://github.com/vllm-project/vllm/blob/main/vllm/entrypoints/openai/tool_parsers/glm4_moe_tool_parser.py), the parser expects tool call IDs in a specific format, and if the model outputs something unexpected (like just `TodoWrite`), this error will occur.

This issue is likely due to the model generating tool call outputs that do not conform to the parser’s expected structure. You may need to check your chat template and ensure the model is prompted to output tool calls in the correct format, or add error handling in the parser to skip or log malformed tool calls. If you need to support more flexible tool call formats, consider modifying the parser to handle cases where `tool_id` does not contain a `.`. Would you like a step-by-step guide on how to patch the parser or adjust your template?

Sources:

- [glm4\_moe\_tool\_parser.py](https://github.com/vllm-project/vllm/blob/main/vllm/entrypoints/openai/tool_parsers/glm4_moe_tool_parser.py)

---

<div class="post-metadata">

### Author: ![adonishong](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@adonishong](https://discuss.vllm.ai/u/adonishong)
#### Post date: [July 31, 2025, 5:57pm UTC](https://discuss.vllm.ai/t/tool-call-issue-with-glm-4-5-air/1254/3 "2025-07-31T17:57:46Z")

</div>

Thank you for your reply, and I was end up at here

> <https://github.com/vllm-project/vllm/pull/21668>
>
> Fix GLM-4 tool streaming output issue.

seems like already fix this issue, and the solution is ready to release, thank you very much, sincerely appreciate for your output 🙂

---

<div class="post-metadata">

### Author: ![RunLLM](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.vllm.ai/runllm/32/233_2.png) [@RunLLM](https://discuss.vllm.ai/u/RunLLM)
#### Post date: [July 31, 2025, 5:58pm UTC](https://discuss.vllm.ai/t/tool-call-issue-with-glm-4-5-air/1254/4 "2025-07-31T17:58:08Z")

</div>

Yes, you are correct—the issue with the GLM-4 tool streaming output has been addressed in the pull request [Fix GLM tool parser](https://github.com/vllm-project/vllm/pull/21668), which specifically fixes the GLM-4 tool streaming output issue. This PR is merged and will be included in the next release.

If you need the fix immediately, you can build vLLM from the latest main branch. Would you like instructions on how to do that?

Sources:

- [Fix GLM tool parser](https://github.com/vllm-project/vllm/pull/21668)
