Commit Graph
1 Commits
Author SHA1 Message Date
yetone d1b65007ff zcode 0.1.24: Claude Code's tool search goes to ZCode's plans as ToolSearchTool, so a subagent sees Bash, Read and Write
小八 (Discord #general, 10-24): Claude Code through magpie on ZCode
(glm-5.3, glm-5.3-flash) gave subagents only the deferred MCP tools;
Bash, Read and Write were missing. Another upstream worked.

Cause, measured against api.z.ai with a real GLM Coding Plan account:
when a request's tools include one named exactly "ToolSearch", z.ai
shows the model none of the other tools except those a tool_reference
loaded. Claude Code 2.1.310's subagent request (captured from the real
binary in a sandbox HOME) has Agent, Bash, Edit, Read, Skill,
ToolSearch, DeferredToolPlaceholder (defer_loading) and Write. Input
tokens for that request: 2886 with ToolSearch, 2439 with no tools at
all, 5995 without ToolSearch. ToolSearch plus Bash also counts 2886.
Renaming the tool (tool_search, ToolSearchTool, SearchTools, ...) gives
6346, every tool counted. The anthropic-beta header changes nothing
(with or without advanced-tool-use: 2886), and neither does
defer_loading. So 0.1.22's dropped beta on the Start Plan is not the
cause; the coding plan path, which keeps the agent's headers, fails
the same way. ZCode 3.14.3's own client sends no ToolSearch tool and
no defer_loading (glm/zcode.cjs).

Now every path (GLM Coding Plan, team, Start Plan and gift) sends
Claude Code's ToolSearch as ToolSearchTool, in the tools and in the
assistant turns that called it. Tools go without defer_loading, as
ZCode's do; Claude Code sends a deferred tool's schema only after a
search loaded it. DeferredToolPlaceholder is left out. The tool_reference
results stay. The model's calls to ToolSearchTool come back to Claude
Code as ToolSearch, in a stream's content_block_start or a whole
message's content. A request without ToolSearch, or one that already
has a tool named ToolSearchTool, goes as before.

Run:
- toolsearch.test.mjs: 4 of 5 fail on 0.1.23's index.mjs (the
  passthrough test passes on both). bun test packages/zcode under a
  scratch HOME: 97 pass. bun scripts/check.mjs zcode: ok.
- Real, through the plugin's fetch to api.z.ai (GLM Coding Plan),
  real Claude Code 2.1.310 in a sandbox HOME with a stdio MCP server:
  on 0.1.23, "spawn a subagent to run ls -a with Bash" ended with the
  model saying it had no Agent tool. On this change the subagent ran
  Bash and returned the listing. A deferred MCP tool loaded through
  ToolSearch (now sent as ToolSearchTool) and was then called.

Not tried: the Start Plan against z.ai. The account's Start Plan
quota is spent (1005 exceed quota limit), so that path has only the
fake-server test. BigModel (open.bigmodel.cn) was not tried either.
2026-10-24 07:37:51 +08:00