Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): all MCP tools now send compact schemas, cutting tool context by 23% #25790

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/25790/headmerged 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. Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — This changes the default tools/list schemas 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.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    2. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB−7 B (−0.1%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB−7 B (−0.6%)2.0 KiB✅
      CodexLive turn WebSocket decoded20.9 KiB20.9 KiB0 B (0.0%)29.3 KiB✅
      CodexLive turn messages220 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB+7 B (+0.1%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB+7 B (+0.6%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiB✅
      ClaudeLive turn messages220 (0.0%)8✅

      Baseline: bea2e9d · PR result: 6afba7e · Source CI: success

      Scenario 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.

    3. Review in Change Stack →

      No actionable comments were generated in the recent review.

      Recent review info
      Run configuration
      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.ts
      • apps/server/src/mcp/McpHttpServer.ts
      • apps/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

      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.json
      Toolkit registration uses advertisedJsonSchema for matching tools and leaves unmatched tools unchanged. The test checks registered tool counts and schemas. The configured tool-list byte count is updated.
      Priority: Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Possibly related PRs

      Suggested labels: bugfix, size:S

      Suggested reviewers: juliusmarminge, macroscopeapp

      Merge Risk: Minimal · up to 6afba

      The available evidence shows no actionable issue that would prevent merging after normal checks.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title clearly identifies the server fix and its primary effect: MCP tools now advertise compact schemas and reduce tool context by 23%.
      Description checkPassedThe description explains the problem, implementation, compatibility behavior, scope, measured impact, and verification results. It also references the related issue and review approval.
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck 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
      Comment `@coderabbitai help` to get the list of available commands.

Sign in to join this conversation.