Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(server): advertised MCP schemas merge tagged unions into one object #25125

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 1 commit intofeat/mcp-schema-noise fromfeat/mcp-schema-tagged-unionsopened View on GitHub

Problem

After #25018, the advertised MCP schemas still spell out every tagged union branch by branch: projectIcon repeats its 18-color enum, schedule, workspaceStrategy, sourcePoint, and the navigate target repeat shared fields per branch.

Change

advertisedJsonSchema advertises a tagged union of objects (a shared property whose value is one literal per branch) as one object: the tag's enum lists every value, each other property appears once, and only fields every branch requires stay required. Decoding still uses the full union, so each tag's own required fields still apply and a wrong combination fails with the schema's message.

projectIcon: {"type":"object","properties":{"kind":{"type":"string","enum":["lucide","emoji","monogram"]},"name":{"type":"string"},"color":{"type":"string","enum":[...18 colors once...]},"emoji":{"type":"string"},"text":{"type":"string"}},"required":["kind"]}

Stacked on #25018.

Scope and approval

Maintainer work (Theo), tool-definition hill climb after #24850.

Verification

Full tool schemas, with the tool merges from #25124: 45,026 → 43,135 chars (about −1,900 chars, −470 tokens).

MCP eval (#24635) on the 24 cases whose expected calls use a tool with a merged union: Claude Opus 5.5 46 of 46 samples, GPT-6.1 Sol 96% of 47 (its one weak case, codex-same-model-subagents-stay-native, is a native-subagent decision and was weak on main). Full runs with this change: Opus 83 of 85 cases (95%), GPT-6 Astra 83 of 83 (99%).

vp test run src/mcp passes; advertisedJsonSchema.test.ts covers the merge.

Changes made with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

    1. Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — This PR changes the schemas advertised for existing MCP tools by merging tagged unions into new object shapes, using nontrivial new transformation logic. Although invocation validation remains separate and the change is tested, the externally consumed runtime contract changes across existing paths.

      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.

      ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire—5.0 KiB—6.8 KiB✅
      CodexThread snapshot wire—3.8 KiB—4.9 KiB✅
      CodexLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      CodexLive turn WebSocket decoded—20.9 KiB—29.3 KiB✅
      CodexLive turn messages—2—8✅
      ClaudeTotal thread wire—5.0 KiB—6.8 KiB✅
      ClaudeThread snapshot wire—3.8 KiB—4.9 KiB✅
      ClaudeLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      ClaudeLive turn WebSocket decoded—21.2 KiB—29.3 KiB✅
      ClaudeLive turn messages—2—8✅

      Baseline: unavailable · PR result: be2b4f4 · Source CI: failure

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

      🤖 Claude Opus 5.5 responding on behalf of Theo

      Superseded by #25423, which combines this with the other MCP simplification PRs on current main.

Sign in to join this conversation.