feat(mcp)!: advertise only agent inputs in MCP tool schemas
Merged
TH
2d ago+109+109+012345678901234567890123456789-60-60-01234567890123456789
Summary
tools/list cost ~268 KB. Clients that defer tool schemas then call tools without them, and clients that compact schemas above ~5 KB drop their structure. This cuts the advertised input schemas at their owners (common input fields, MCP control fields, flag inputDescriptions); no per-tool schemas.
- Breaking (MCP and AI SDK tools):
tenant,runId,leaseId,androidDeviceAllowlistbecome operator-owned. Explicit input is refused with the operator path. Env/config defaults still reach the route (test added). - Trimmed repeated property descriptions (device selectors, MCP controls, proxy lease spec,
settleQuietMs,openwaitMs/metroPort). - Server instructions: one sentence to load a deferred tool's schema before its first call.
- Gate: every input schema ⤠5 KB, and no declared operator key is advertised, both derived from
listCommandTools().
tools/list (62 tools) | before | after |
|---|---|---|
| total | 268,371 B | 216,362 B |
| input schemas | 168,497 B | 116,488 B |
| largest input schema | 7,109 B (open) | 4,757 B (open) |
| repeated common props | 115,537 B | 71,066 B |
| output schemas (untouched) | 75,699 B | 75,699 B |
12 files. The proxy lease device spec stays advertised (#3864 decided it is agent-visible); only its descriptions shrank.
Validation
validation: CI. At 5d4ac57: focused vitest --project unit-core on src/mcp, src/ai-sdk, packages/command-surface, packages/command-registry, packages/contracts passed (192 files, 1408 tests); pnpm typecheck and oxlint clean. Bytes measured from the built server over stdio.
š¤ Generated with Claude Code