feat: expose responseLevel over MCP — Phase 4#944
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
Blocking this one for the MCP optimized text path. When an MCP caller sets Please add a shipped-path MCP test for |
When an MCP caller sets responseLevel:digest/full, structuredContent carries the leveled (e.g. snapshot digest) payload, but renderToolText still ran it through the optimized CLI formatters, which assume the default shape — the snapshot formatter expects `nodes` (the digest drops them) and printed 'Snapshot: 0 nodes', contradicting structuredContent. Bypass the optimized formatters for any non-default responseLevel and emit the leveled payload verbatim as JSON. Adds the shipped-path test (snapshot, mcpOutputFormat:optimized, responseLevel:digest).
|
Fixed (pushed). You're right — the optimized text path mis-rendered the digest. |
|
Re-reviewed the fix at The previous MCP optimized-text blocker is addressed: All 21 checks are green. I do not see an actionable blocker now. |
|
What
Phase 4: let MCP agents opt into the leveled response views that #942 added, mirroring how
includeCostis exposed at the MCP boundary.src/mcp/command-tools.ts:readClientConfigreads aresponseLeveltool arg, validates it againstRESPONSE_LEVELS('digest' | 'default' | 'full'), and setsclient.responseLevelonly for valid values; rejects other non-undefined values with a clear error. (Extracted a smallreadResponseLevelhelper to keepreadClientConfigunder the fallow complexity threshold.)stripMcpConfigFieldsstripsresponseLevelso it never leaks into the command input.withMcpConfigSchemaadvertisesresponseLevel: { type: 'string', enum: ['digest','default','full'], … }in every tool's inputSchema.Default-off is byte-identical
With
responseLevelabsent,client.responseLevelis never set and the request shape is unchanged — same additive, MCP-boundary-only pattern asincludeCost. Covered by a test asserting the absent path yields an empty config.Verification
tsc --noEmit0;oxfmt+oxlint --deny-warningsclean;fallow audit --base origin/mainclean;vitest run src/mcp25 pass; Layering Guard empty.Built by a delegated worker; rebased onto main after #942 merged. Tests: digest→config + arg stripped; absent→byte-identical; invalid rejected; inputSchema advertises the enum.