fix(server): all MCP tools now send compact schemas, cutting tool context by 23% #25790
main fromrefs/pull/25790/head·merged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub#25423 was meant to have the T3 MCP server advertise compact tool schemas. In practice only the 3 hand-registered tools got them. The other 63 tools are registered through McpServer.registerToolkit and still sent the full schema: null branches on optional fields, additionalProperties: true, safe-integer bounds, and so on. Every thread paid for that.
Now toolkitRegistration gives registerToolkit a server whose addTool replaces each tool's inputSchema with advertisedJsonSchema. Decoding still uses the full schema, so inputs that worked before still work.
The model-facing tool list goes from 54,964 to 42,328 bytes (−23%). This PR lowers agentContextBudget.json to match, so the new budget check holds the lower number. evals/mcp-tool-use already built its tool schemas with advertisedJsonSchema, so the eval results from #25423 describe what ships now.
Proof: the new McpHttpServer.test.ts case fails on main (preview_dialog has the full schema) and passes with the fix. All 233 MCP and budget tests pass, and vp run check:changed passes. Reviewed with sol-loop: 1 round with GPT-6.1 Sol. Sol verdict: approved.
Created with Claude Opus 5.5 in T3 Code (Claude Code harness).
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Provider Metric Main baseline This PR Impact PR ceiling Codex Total thread wire 5.0 KiB 5.0 KiB −7 B (−0.1%) 6.8 KiB ✅ Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB −7 B (−0.6%) 2.0 KiB ✅ Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅ Codex Live turn messages 2 2 0 (0.0%) 8 ✅ Claude Total thread wire 5.0 KiB 5.0 KiB +7 B (+0.1%) 6.8 KiB ✅ Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅ Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB +7 B (+0.6%) 2.0 KiB ✅ Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅ Claude Live turn messages 2 2 0 (0.0%) 8 ✅ Baseline:
bea2e9d· PR result:6afba7e· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: t3/compact-mcp-tool-schemas
- File: .coderabbit.config.ts
- Commit: 6afba7e
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Team
- Run ID:
329c6267-ef7b-4015-b27f-55c3d8d970c3
Commits-
Reviewing files that changed from the base of the PR and between bea2e9d62fdc2440c2db4d670b8741425b526969 and 6afba7e2e12ec50378b0a25a2cee46de96062b15.
Files selected for processing: 3-
apps/server/src/mcp/McpHttpServer.test.tsapps/server/src/mcp/McpHttpServer.tsapps/server/src/provider/agentContextBudget.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
-
Walkthrough
-
Toolkit registration now advertises matching tools with schemas produced by
advertisedJsonSchema. A test checks the registered tool count and schemas. The configured MCP tool-list byte count decreases from 54,964 to 42,328.Changes: MCP Toolkit Schema Advertising
Priority:Layer / File(s) Summary Advertise toolkit schemas during registration
apps/server/src/mcp/McpHttpServer.ts,apps/server/src/mcp/McpHttpServer.test.ts,apps/server/src/provider/agentContextBudget.jsonToolkit registration uses advertisedJsonSchemafor matching tools and leaves unmatched tools unchanged. The test checks registered tool counts and schemas. The configured tool-list byte count is updated. NormalEstimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- pingdotgg/t3code#25785: Measures the registered MCP tool list and stores its byte budget.
- pingdotgg/t3code#25423: Introduces
advertisedJsonSchemaand applies schema compaction to existing MCP registrations. - pingdotgg/t3code#25018: Applies
advertisedJsonSchemato selected preview and image tools.
Suggested labels:
bugfix,size:SSuggested reviewers:
juliusmarminge,macroscopeapp
Merge Risk:
Minimal · up to6afba-
The available evidence shows no actionable issue that would prevent merging after normal checks.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly identifies the server fix and its primary effect: MCP tools now advertise compact schemas and reduce tool context by 23%. Description check The description explains the problem, implementation, compatibility behavior, scope, measured impact, and verification results. It also references the related issue and review approval. Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request.
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Approvability#
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — This changes the default
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).tools/listschemas for all MCP toolkit tools, reducing context size but altering the schema agents receive on every existing path. The execution logic remains localized and tested, but the global default behavior warrants human review.