feat(mcp)!: preload loop tools, trim schemas, and shorten errors
Merged
TH
3h ago+551+551+012345678901234567890123456789-192-192-012345678901234567890123456789
Summary
Claude Code defers MCP tool schemas: each tool a run needs costs a tool-search turn, and a failed call to an unloaded tool gets its whole schema appended. This PR cuts both costs.
_meta["anthropic/alwaysLoad"]on the new'loop'tier (part of'core'): open, snapshot, press, fill, back, wait, scroll; screenshot stays on demand, since preloading it caused detours. Every tool gets_meta["anthropic/searchHint"]from its command text.- Extends #4468's operator rule to
debug,cost, andresponseLevel. A newaliasaudience sends tool calls todeviceTargetinstead oftarget. - Loop tool descriptions carry the command help's usage guidance.
batchdocuments its step shape with thehelp batchexamples. - MCP errors show
Error (CODE, reason)and one line, then the log path when one exists. MCPopendropsSession state:.
tools/list | before (80075b6) | after |
|---|---|---|
| total, 62 tools | 148,296 B | 114,950 B |
| always-loaded | 27,872 B (8) | 21,377 B (7) |
Breaking changes for MCP clients
MCP tool calls are refused for mcpOutputFormat (removed), includeCost, responseLevel, debug, and target; AI SDK calls refuse debug and target and drop the rest. For JSON text, set AGENT_DEVICE_RESPONSE_LEVEL or AGENT_DEVICE_COST; for a form factor, use deviceTarget.
Validation
Focused unit suites, typecheck and lint pass; byte counts come from the built server over stdio. Not device-facing; CI owns full validation.
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.