Skip to content

fix: render optimized MCP command output by default#748

Merged
thymikee merged 1 commit into
mainfrom
fix/mcp-optimized-output
Jun 10, 2026
Merged

fix: render optimized MCP command output by default#748
thymikee merged 1 commit into
mainfrom
fix/mcp-optimized-output

Conversation

@thymikee

Copy link
Copy Markdown
Member

Summary

MCP command tool text now defaults to the same optimized, agent-friendly renderer used by CLI output projections, so snapshots and other commands with shared renderers no longer fall back to pretty JSON in content.

Added mcpOutputFormat: "optimized" | "json" as an MCP-only schema field for clients that need JSON text; it is stripped before command execution, while structuredContent remains the raw command result. Closes #747.

Touched files: 2.

Validation

Focused MCP tests pass for default optimized snapshot output, explicit JSON text output, schema exposure, and router tool listing. Full quick validation passed with lint and typecheck, and git diff --check passed.

Commands run: pnpm exec vitest run src/mcp/__tests__/command-tools.test.ts src/mcp/__tests__/router.test.ts; pnpm check:quick; pnpm format; git diff --check.

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.2 MB 1.2 MB +1.4 kB
JS gzip 385.4 kB 385.5 kB +71 B
npm tarball 496.7 kB 496.8 kB +168 B
npm unpacked 1.7 MB 1.7 MB +1.4 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 25.0 ms 25.1 ms +0.1 ms
CLI --help 39.9 ms 40.0 ms +0.1 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/8173.js +36.4 kB +12.9 kB
dist/src/1620.js +32.0 kB +10.7 kB
dist/src/cli.js -26.4 kB -9.4 kB
dist/src/9533.js -3.4 kB -1.2 kB
dist/src/8699.js -23 B -6 B

@thymikee thymikee force-pushed the fix/mcp-optimized-output branch from a7f1658 to 6919c1b Compare June 10, 2026 11:59
@thymikee

Copy link
Copy Markdown
Member Author

Review status: behavior looks aligned with #747 from the diff. MCP text now defaults through the existing optimized CLI renderer, explicit mcpOutputFormat: "json" keeps JSON text available, structuredContent remains the raw result, and the MCP-only field is stripped before command execution.

The blocker is CI/maintainability: Fallow fails on src/mcp/command-tools.ts:95 readMcpToolConfig after the added branching. Please split the MCP config parsing enough to get the changed-file Fallow audit green, ideally by keeping readMcpToolConfig as orchestration and moving output-format/client-field validation into focused helpers.

@thymikee

Copy link
Copy Markdown
Member Author

Update after the latest checks: Fallow is now green on the current head. Treat my previous note as resolved/stale; I do not have a remaining code-review blocker from the sampled diff. Current status from my side is merge-ready once the remaining pending smoke/Swift CodeQL checks complete green.

@thymikee thymikee merged commit 2dea65e into main Jun 10, 2026
20 checks passed
@thymikee thymikee deleted the fix/mcp-optimized-output branch June 10, 2026 12:28
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-10 12:28 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: MCP command tools should return optimized text output by default

1 participant