Repository navigation
fix(mcp): present discover_tools input through the selected profile - #10592
Merged
Merged
Conversation
The hot-cold catalog registered discover_tools directly with the SDK, so the default compact input profile still advertised its canonical schema, including page-size defaults clients apply on their own (#5322). Route every listed input schema, transport discovery included, through one server-owned presentation, and pass the selected presentation to the deferred server, which serves recorded tool schemas but not discovery.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The PR appears safe to merge; no actionable issue remains from the reviewed changes. SummaryRoutes
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
Profile["Selected input profile"] --> Eager["Eager server"]
Profile --> Deferred["Deferred server"]
Eager --> Present["Shared input presentation"]
Deferred --> Discovery["discover_tools"]
Discovery --> Present
Deferred --> Recorded["Profile-specific recorded tool schemas"]
Present --> Listed["tools/list"]
Recorded --> Listed
Calls["tools/call"] --> Canonical["Canonical input parser"]
Canonical --> Handler["Tool handler"]
Reviews (16) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
1 of 12 tasks
… into HEAD # Conflicts: # scripts/lib/verify-package-core.mjs # src/contracts/advertisedDialectBaseline.ts # tests/boundary/mcp/advertisedDialect.test.ts
This was referenced Nov 14, 2026
# Conflicts: # tests/boundary/mcp/advertisedDialect.test.ts
# Conflicts: # docs/development/testing.md # scripts/lib/verify-package-core.mjs # src/contracts/advertisedDialectBaseline.ts # tests/boundary/mcp/advertisedDialect.test.ts # tests/boundary/mcp/advertisedPatternsVMode.test.ts
…esentation widens
…referencing branches out of the collapse
…draft-07 reference siblings
* fix(mcp): keep the Evidence union on described borrowed inputs borrowEvidenceInput installed its advertised projection on one schema instance. A call site's .describe() rebuilds the schema from its definition, so match_native_functions advertised left and right as unconstrained values in every input profile. Install the projection in the borrowed parser's constructor so derived schemas keep it, for both borrowed inputs and borrowed arrays. * test(mcp): select the borrowed Evidence contract from its family
morluto
changed the base branch from
fix/portable-advertised-patterns
to
main
November 15, 2026 09:06
…tools-input # Conflicts: # docs/development/testing.md # src/contracts/advertisedDialectBaseline.ts
…tools-input # Conflicts: # src/contracts/advertisedDialectBaseline.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Under
REA_MCP_TOOL_CATALOG_PROFILE=hot-cold,discover_toolsbypassed the selected input presentation: with the default compact input profile it still advertised its canonical schema, includingdefaultvalues foroffsetandlimit(clients apply advertised defaults themselves, #5322) and nested annotations the compact profile strips from every other tool. This routes every listed input schema, transport discovery included, through one server-owned presentation.Stacked on #10582 (and #10567). Follow-up named in #10567's review notes. Refs #9347.
Problem and expected behavior
rea mcpwithREA_MCP_TOOL_CATALOG_PROFILE=hot-coldand the default input profile, thentools/list.discover_tools.inputSchema.properties.offsetcarried"default": 0andlimit"default": 3; the dialect baseline recorded this asinput keyword default: 2for the compact profile.super.registerTool, and the deferred production server (default stdio start) was constructed without the selected presentation because it serves recorded tool schemas, while discovery is not recorded.Change and scope
EvidenceMcpServerCore.presentInputSchemais the one place that applies the selected input presentation;registerToolandenableProgressiveCatalogboth use it.DeferredEvidenceMcpServernow takes an options object (maximumInputElements,compactPresentation);deferredRuntimepasses the presentation for the selected profile. Recorded tool schemas are unchanged (they are still borrowed from the build-owned catalog); only discovery uses it.input keyword defaultentry, so a regression fails the existing exact-match check.borrowEvidenceInputinstalls its advertised projection in the borrowed parser's constructor, so a call site's.describe()copy keeps it. Restored declaration:match_native_functions.left/rightadvertise the Evidence union instead of unconstrained values in every profile. This is why thefullbaseline counts rise (any-of fewer-than-two-branches168 to 176,untyped-branch136 to 142,const,oneOf,prefixItems,propertyNames,type-list,type:null,untyped);advertisedDialectBaseline.tsanddocs/development/testing.mdnow admit growth only for such a named restored declaration.Contract and boundary impact
Semantic owner and earliest changed stage:
EvidenceMcpServerCore.presentInputSchema(server registration). Consumers: SDKtools/listfor every registration, includingdiscover_tools.Contribution scope fit and linked maintainer decision: not applicable (fix within the existing MCP presentation boundary).
CLI and MCP/tool-catalog contract: compact-profile
discover_tools.inputSchemalosesdefault, nested descriptions and$schema, matching other tools. Full profile unchanged. Server-side validation unchanged.Provider, bridge, target-format, or platform compatibility: none.
Evidence, artifact, provenance, or reconstruction contract: none.
Target selection, authority, upstream behavior, and cleanup details: not applicable.
Generated metadata, package, or installation impact: none; recorded catalogs do not contain
discover_tools.Documentation or usability only; no target interaction.
Evidence and regression coverage
tests/boundary/mcp/advertisedDialect.test.ts: new case comparesdiscover_toolsunder full (defaults kept) and compact (exact compact form); the compact baseline dropsinput keyword default.tests/boundary/mcp/deferredRuntime.test.ts: the hot-cold stdio cases now assert the deferred server advertises the compact discovery schema with nodefault.src/serverchange reverted, bothadvertisedDialect.test.tscases failed (2 failed / 30). With only thedeferredRuntime.tswiring reverted, the two default-profile hot-cold cases indeferredRuntime.test.tsfailed (2 failed / 36).Validation performed
npm run test:focused -- tests/boundary/mcp/deferredRuntime.test.ts src/server/DeferredEvidenceMcpServer.test.ts tests/boundary/mcp/advertisedDialect.test.ts— 3 files, 83 tests passed.npm run test:focused -- tests/boundary/mcp/deferredRuntime.test.ts tests/boundary/mcp/advertisedDialect.test.ts src/server/ProgressiveToolCatalog.test.ts src/server/DeferredEvidenceMcpServer.test.ts— 4 files, 94 tests passed (before the constructor options refactor).npm run check:fast— typecheck and lint passed.npx oxfmt --checkon changed files — clean.npm run test:focused -- tests/boundary/mcp/advertisedDialect.test.ts tests/boundary/mcp/deferredRuntime.test.ts src/server/DeferredEvidenceMcpServer.test.ts: 88 passed;npm run check:fastpassed;npm run docs:checkpassed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.