#76: Zen's free models sometimes call a tool by a name the agent never
declared (tkhs101's table: bedit, bcp, ash, mcp__netcatcatty__unused,
beside declared edit, bash, mcp__netcatty-external__list_hosts). The
guard answered each with "Upstream called a tool not declared by the
client", which failed the whole turn. The rows without a name are from
before 0.1.1 (published 10-10 11:51 UTC), which added the name.
Now such a call (or one with no name) is left out of the reply instead:
- chat: dropped from tool_calls/function_call; the reply's content says
"(The model called a tool this agent doesn't have: "bedit". The call
was left out.)"; kept calls are renumbered from 0; finish_reason
becomes "stop" when no call is left, including a repeated finish.
- responses: the function_call item becomes a message item with the
note (added, text deltas, done, and in response.completed); its
argument events are not passed on.
- anthropic: the tool_use block becomes a text block with the note; its
input deltas are not passed on; stop_reason tool_use becomes end_turn
when no call is left.
A call of an unsupported type (custom tools, non-object input) still
fails as before.
Run:
- bun test packages/zen-free: 155 pass, 0 fail; node --test
packages/zen-free/*.test.mjs: 155/155; bun scripts/check.mjs zen-free.
- The new tests on the old tool-response.mjs: 35 fail.
- Breaking the finish rewrite by hand: 5 fail.
- Chat stream fixtures use the shape a live step-5-preview-free stream
sent (name whole in the first delta, arguments in pieces, two
tool_calls finishes). Zen sends names whole, so the names in #76 are
the model's own; a real misnamed call was not reproduced live.