Environment
- Model:
glm-5.1
- API: Anthropic-compatible endpoint (
/api/anthropic)
- Client: Claude Code CLI
Description
When using Claude Code's ToolSearch (deferred tool discovery) feature, GLM-5.1 receives a response containing a tool_reference content block but fails to interpret its meaning, concluding that "no tools were found" instead of proceeding to call the referenced tool.
Reproduction
- Configure GLM-5.1 as the backend model in Claude Code (via Anthropic-compatible API)
- Trigger an ultracode/multi-agent workflow (e.g., include the keyword
"ultracode" in a prompt)
- GLM-5.1 calls
ToolSearch to discover the Workflow tool
- The tool response returns:
{
"content": [
{
"type": "tool_reference",
"tool_name": "Workflow"
}
]
}
- Expected behavior: GLM-5.1 recognizes
tool_reference means the tool is available and calls Workflow directly
- Actual behavior: GLM-5.1 responds "The tool search didn't return any Workflow tool" and stops execution
Comparison with Other Models
| Model |
Correctly handles tool_reference |
Xiaomi Memo (mimo-v2.5-pro) |
✅ Yes |
| Claude Sonnet 4 |
✅ Yes |
| GLM-5.1 |
❌ No |
Root Cause
GLM-5.1's training data does not appear to include the tool_reference response type from Anthropic's tool-use protocol. When a tool_result contains a content block with type: "tool_reference", the model should interpret it as: "this tool is now registered and available for direct invocation." Instead, GLM-5.1 treats it as an unrecognized/empty response.
Workaround
Adding explicit guidance about tool_reference in the system prompt enables GLM-5.1 to handle it correctly:
## Understanding tool_reference Response Type
When ToolSearch returns a response containing:
{"type": "tool_reference", "tool_name": "Workflow"}
This means the tool is now available. Call it directly:
Workflow({script: "...", title: "..."})
I verified at the API level that with this additional system prompt context, GLM-5.1 correctly interprets tool_reference and invokes the Workflow tool as expected.
Suggested Fix
Include tool_reference response type understanding in GLM-5.1's fine-tuning / tool-use training data, so the model natively treats {"type": "tool_reference", "tool_name": "..."} as a signal that the named tool is registered and ready to be called directly — no additional system prompt guidance needed.
Related
- Claude Code uses deferred tool discovery to reduce token usage. Tools like
Workflow, TeamCreate, etc. are not loaded at session start and are discovered on-demand via ToolSearch.
- The
tool_reference type is part of Claude Code's internal tool protocol for signaling that a deferred tool has been loaded.
Environment
glm-5.1/api/anthropic)Description
When using Claude Code's
ToolSearch(deferred tool discovery) feature, GLM-5.1 receives a response containing atool_referencecontent block but fails to interpret its meaning, concluding that "no tools were found" instead of proceeding to call the referenced tool.Reproduction
"ultracode"in a prompt)ToolSearchto discover theWorkflowtool{ "content": [ { "type": "tool_reference", "tool_name": "Workflow" } ] }tool_referencemeans the tool is available and callsWorkflowdirectlyComparison with Other Models
tool_referencemimo-v2.5-pro)Root Cause
GLM-5.1's training data does not appear to include the
tool_referenceresponse type from Anthropic's tool-use protocol. When atool_resultcontains a content block withtype: "tool_reference", the model should interpret it as: "this tool is now registered and available for direct invocation." Instead, GLM-5.1 treats it as an unrecognized/empty response.Workaround
Adding explicit guidance about
tool_referencein the system prompt enables GLM-5.1 to handle it correctly:## Understanding tool_reference Response Type When ToolSearch returns a response containing: {"type": "tool_reference", "tool_name": "Workflow"} This means the tool is now available. Call it directly: Workflow({script: "...", title: "..."})I verified at the API level that with this additional system prompt context, GLM-5.1 correctly interprets
tool_referenceand invokes the Workflow tool as expected.Suggested Fix
Include
tool_referenceresponse type understanding in GLM-5.1's fine-tuning / tool-use training data, so the model natively treats{"type": "tool_reference", "tool_name": "..."}as a signal that the named tool is registered and ready to be called directly — no additional system prompt guidance needed.Related
Workflow,TeamCreate, etc. are not loaded at session start and are discovered on-demand viaToolSearch.tool_referencetype is part of Claude Code's internal tool protocol for signaling that a deferred tool has been loaded.