Skip to content

perf(mcp)!: default tools/list to omit output schemas - #9869

Closed
carloscoyote15-beep wants to merge 2 commits into
morluto:mainfrom
carloscoyote15-beep:mcp-default-output-off
Closed

carloscoyote15-beep wants to merge 2 commits into
morluto:mainfrom
carloscoyote15-beep:mcp-default-output-off

Conversation

@carloscoyote15-beep

@carloscoyote15-beep carloscoyote15-beep commented Nov 10, 2026 •

Copy link
Copy Markdown

Summary

Defaults REA_MCP_OUTPUT_SCHEMA_PROFILE to off: tools/list no longer advertises
outputSchema, matching the compact input default introduced in #5975. Completes the
scope selected in #5861 ("modificación de REA_MCP_OUTPUT_SCHEMA_PROFILE a OFF
por defecto manteniendo la sintonización diferida coherente y documentando la
combinación off+compact").

  • Keeps REA's canonical validation and complete structuredContent unchanged.
  • full remains opt-in for clients that discover or validate output schemas locally.
  • Independently fixes a Windows-only registration_path_mismatch in
    src/serverIdentity.ts (commit 1) that blocked local validation; it is unrelated to
    the profile change (see Validation).

Problem and expected behavior

Issue #5972/#2512 measured ~1,033K tokens of context consumed by full advertised
output schemas in tools/list; the off profile drops this to ~57K (5.5%).
Previously every host paid that cost unless it knew to set the environment
variable. Expected: default advertisement omits output schemas; existing explicit
choices keep working; server identity, doctor, and CLI status report the
(selected) profile exactly as before.

Change and scope

  • resolveMcpOutputSchemaProfile(undefined) → off; consumers resolve at the
    configuration boundary (createServer, mcpDoctor, DirectAnalysisStatus,
    deferred runtime, DEFAULT_CATALOG_IDENTITY).
  • Deferred startup keeps working for the new default: the recorded catalog is
    recorded with REA_MCP_OUTPUT_SCHEMA_PROFILE: "full" (recorder pins it), and the
    deferred transport strips output schemas while the resolved selection is off.
    The deferred server stitches the resolved profile's identity from
    RECORDED_CATALOG_DIGEST_PROFILES without loading the contract graph.
  • Explicit full, and unparseable values, load the eager runtime (invalid values
    surface as the existing typed configuration errors).
  • Consumers that owned the previous full-by-default assumption were updated:
    catalog recorder pins full; verify-claude-client.mjs resolves the profile;
    verify-apk-signature.mjs and scripts/lib/artifact-e2e.mjs pin full
    (they validate client-side against the advertised schema).
  • Docs updated: README.md, docs/mcp-contracts.md ("Output schemas"),
    docs/client-configuration.md; the compact+off combination is already a
    doctor/identity test row.

Contribution scope: profile value selection within the existing MCP contract
boundary; no new provider or target-execution capability. Not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: resolveMcpOutputSchemaProfile
    resolves the selection once at the configuration/identity boundaries.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: the four (input × output) profile
    identities remain distinct and recorded; tools/list shape changes only for
    the default selection.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged;
    canonical output validation and delivery are unchanged.
  • Generated metadata: docs/public/product-catalog.json, skills/, catalogs
    regenerated and validated by the CI/artifact tasks (not committed here).
  • Effects checked:
    • Read existing files or captured data.
    • Documentation or usability only; no target interaction.
    • (others: not applicable)

Evidence and regression coverage

  • Tests added or updated: tests/boundary/mcp/deferredRuntime.test.ts (phase
    rows: off→deferred, explicit full→eager; tools/list projections strip
    outputSchema; profile preservation for off/compact/full),
    tests/boundary/mcp/serverIdentity.test.ts (DEFAULT = compact+off),
    tests/boundary/mcp/mcpDoctor.test.ts (probe capture pins full so the
    client-side schema-violation check keeps working),
    src/server/DeferredEvidenceMcpServer.test.ts (identity parameter).
  • Commit 1 fixes a Windows-only failure observable before this change:
    tests/boundary/mcp/serverIdentity.test.ts "reports unknown without a live
    comparison and distinguishes aligned from stale" failed with
    registration_path_mismatch because resolve() anchored /packaged/rea.mjs
    to a drive while the observed path stayed drive-less; resolving both sides
    fixes it and is a no-op on Linux/macOS.
  • Remaining proof gaps: the #[5972]/[Feature] Opt-in output-schema-light tools/list advertisement for frame-capped MCP clients #2512 catalog-size measurement was not
    re-executed locally; real host-client verification (Claude Code/Codex live
    sessions) was not re-run; lint race with concurrent builds
    (oxlint emits a filename-less global diagnostic when dist/ is being
    rebuilt) is an environmental note, CI runs lint exclusively.

Validation performed

  • npm run check:fast — typecheck + lint passed (0 errors; no new warnings
    versus HEAD)
  • npm run docs:check — passed, including readmeConsistency 9/9
  • node scripts/run-development-tests.mjs focused tests/boundary/mcp/{deferredRuntime,serverIdentity,mcpDoctor,contractPresentation,compactInputSchemaMcp}.test.ts — 82/82 passed (Windows)
  • npm run test:local -- src/server/DeferredEvidenceMcpServer.test.ts — 11/11 passed

Compatibility, safety, and release

  • Breaking changes or migration steps:
    BREAKING CHANGE: MCP tools/list omits advertised output schemas by
    default. Set REA_MCP_OUTPUT_SCHEMA_PROFILE=full in the server entry to
    restore the complete advertised catalog. Existing explicit values
    (off/full) continue to work unchanged.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable (no target
    interaction).
  • Package or release metadata impact: none beyond regenerated (ignored)
    catalogs.
  • Security, privacy, process, or containment review: no new authority;
    advertisement-only change; server-side validation unchanged.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the
    change and its edge cases, and take responsibility for the complete PR,
    including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change,
    and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

resolve() anchored /packaged/rea.mjs to a Windows drive while the observed command path stayed drive-less, reporting a spurious registration_path_mismatch and mcp_server_restart_required state on every Windows host. Resolve both sides once at the owning comparison.

Validated on Windows: tests/boundary/mcp/serverIdentity.test.ts failed at the aligned case before and passes after; Linux/macOS behavior is unchanged because resolved absolute paths are identity there.
Resolve REA_MCP_OUTPUT_SCHEMA_PROFILE to off when unset, matching the compact input default. The recorded catalog is recorded with full output schemas and the deferred transport strips them while the resolved selection is the default off; explicit full selections, and invalid values, load the eager runtime, which reports invalid selections as typed configuration errors. Deferred startup stitches the resolved profile's identity from recorded digest profiles so server identity stays exact without the contract graph. The doctor, CLI status, callers' digest comparisons and profile-preserving discovery keep both profiles working, with the compact+off combination covered.

Update every consumer that owned the previous full-by-default selection: the catalog recorder pins full so canonical output validation survives; the Claude client verifier resolves the selected profile; the apk-signature and artifact verifiers pin full because they validate client-side against the advertised schema. Document the new default in README, MCP contracts and client configuration guides.

Refs morluto#5861

Validated on Windows: npm run check:fast (typecheck + oxlint, 0 errors, no new warnings); npm run docs:check; focused boundary tests 82/82 (deferredRuntime, serverIdentity, mcpDoctor, contractPresentation, compactInputSchemaMcp); src/server/DeferredEvidenceMcpServer.test.ts 11/11. Windows-only failures that predate this change are covered by the preceding identity fix commit. The tools/list token reduction measured in the issue was not re-measured here.

BREAKING CHANGE: MCP tools/list omits advertised output schemas by default. Set REA_MCP_OUTPUT_SCHEMA_PROFILE=full to advertise complete output contracts for client-side discovery and validation.
@morluto

morluto commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you for this contribution. Defaulting REA_MCP_OUTPUT_SCHEMA_PROFILE to "off" has already landed on main via PR #10693 (5c53bcaed8, which sets "off" as the default in src/config/mcpOutputSchemaProfile.ts and retired the "full" profile), and src/process/ServerIdentity.ts already includes registration_path_mismatch. Linked issue #5861 was also closed as completed on 2026-11-20. Closing as already landed.

@morluto morluto closed this Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration performance Performance regressions, scaling limits, and bounded-resource work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants