Repository navigation
refactor(mcp): derive every advertised tool through one owner - #11268
Merged
Merged
Conversation
The server's registration and tools/list rewrite, catalog identity and the Copilot verifier each assembled the advertised description, input and output schema themselves. src/contracts/advertisedTool.ts now owns that composition; served environment catalogs (MCP listing and card) go through the same owner's dialect projection, keeping argument descriptions.
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
[Medium impact] The PR appears safe to merge, with no new actionable findings. SummaryThe PR makes
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
C["Canonical tool schemas"] --> A["advertisedTool.ts"]
P["Presentation settings"] --> A
A --> S["MCP tool listings"]
A --> D["Catalog digests"]
A --> E["Environment cards and listings"]
A --> V["Copilot verifier"]
C --> K["Canonical call validation"]
Reviews (2) · Last reviewed commit: "test(mcp): pin each remaining environmen..." · Reviewed by Greptile |
morluto
added a commit
that referenced
this pull request
Nov 15, 2026
morluto
added a commit
that referenced
this pull request
Nov 15, 2026
…ect projection (#11207) * refactor(mcp): leave input literal portability to the advertised dialect projection * test(mcp): leave listed-input literal portability to the dialect check * test(mcp): trigger normalization dependency cases with non-portable patterns * refactor(mcp): let the dialect projection own input patterns and dependency prose (#11238) * refactor(mcp): let the dialect projection own input patterns and dependency prose * refactor(mcp): drop the unused import from the output schema presentation * test(mcp): force the reduced form by depth now that the projection re-emits patterns * test(mcp): take advertised input from the one advertised-tool owner after #11268 * test(mcp): check the base64 pad-bit widening on the advertised input, not the registered one
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
Three producers assembled "what a client receives for a tool" themselves: the MCP server (input compaction plus guidance at registration, output profile at
tools/list),catalogIdentity.ts(its own input and output presentation for digests), andscripts/verify-copilot-client.mjs(its own compaction call). Served environment catalogs bypassed the advertised dialect entirely and listed recordedoneOfunions. This PR gives the composition one owner,src/contracts/advertisedTool.ts, and routes all four through it.Refs plan W3 ("one function produces everything advertised").
Problem and expected behavior
presentAdvertisedInput,describeAdvertisedToolandpresentAdvertisedOutputSchema(or the profile check) by hand, so a change to the advertised form had to be repeated at each site.rea environment-servelistedoneOf(outside the portable dialect) on every query parameter.advertiseTool(canonical, presentation)returns the advertised description, input schema and output schema.advertiseToolInputandadvertiseToolOutputare the two halves the server needs at its two SDK hook points (registration and thetools/listrewrite).advertisedToolPresentation(outputSchemaProfile, input?)inconfig/mcpOutputSchemaProfile.tsmaps REA's settings onto that presentation. Environment catalogs use theannotatedinput presentation: dialect projection only, with argument descriptions kept, because a served catalog already bounds its own size.Change and scope
src/contracts/advertisedTool.ts. It also owns the output-projection memo that used to live in the server transport.presentAdvertisedInputSchemaanddescribeAdvertisedToolfromcompactInputSchema.ts; the transport'scompactedOutputSchemascache; the profile branch inpresentOutputSchemasForToolsList; catalog identity'spresentedInputandpresentOutputSchemas.describeTool(and the deferred server's override) now receives the advertised description from the owner instead of guidance to combine.advertisedEnvironmentTool(definition)is used by both the MCP registration (viatransformAdvertisedInputJsonSchema, so calls are still validated against the recorded schema) and the environment card.compactJsonSchema.tsare the next W3 PR.string | number | boolean | string[]union. After projection, that node is an untypedanyOf, which the dialect check still flags astype/untyped. The new regression test pins that this is the only remaining violation. Choosing the portable form (narrow to one type, or relax the rule for typed-branch unions) needs a decision and is not made here.Contract and boundary impact
Semantic owner and earliest changed stage:
src/contracts/advertisedTool.ts(new). Consumers:EvidenceMcpServerCore,DeferredEvidenceMcpServer,catalogIdentity.ts,serveEnvironment.ts,environmentTools.ts(card),scripts/verify-copilot-client.mjs.Contribution scope fit and linked maintainer decision: not applicable (refactor within the existing advertised-schema boundary; W3 plan).
CLI and MCP/tool-catalog contract: REA's own
tools/listand catalog digests are unchanged (verify:advertised-schemassummary unchanged; digest tests pass). Environmenttools/listand card change:oneOfbecomesanyOf, emptyrequired: []is dropped, and the description key moves beforeanyOf. The accepted values are the same.Provider, bridge, target-format, or platform compatibility: none.
Evidence, artifact, provenance, or reconstruction contract: none. Environment validation still uses the recorded schema.
Target selection, authority, upstream behavior, and cleanup details: not applicable.
Generated metadata, package, or installation impact: none.
Read existing files or captured data.
Launch or attach to a process.
Inject instrumentation or run scripts/code.
Change process memory, registers, files, or configuration.
Contact network services.
Recover protected code or work around protections.
Documentation or usability only; no target interaction.
Not sure yet; investigation or maintainer guidance needed.
Evidence and regression coverage
environmentServeMcp.test.tschecks every listed served tool againstadvertisedInputDialectViolations; only the documented union node may remain. The repeated-query test now expectsanyOf. The pinned card digest is updated.serveEnvironment.test.ts,environmentTools.test.ts) compare againstadvertisedEnvironmentTool.compactInputSchemaMcp,serverWorkflowMcpandcontractPresentationcompare listed tools withadvertiseTool.oneOfon the base path. On the base, the new dialect assertion fails withkeyword: oneOfon each query parameter (source-derived from that listing).Validation performed
npm run check:fast— passed (typecheck, lint, architecture guards across 2844 files).npm run test:focused -- src/server/environment/serveEnvironment.test.ts src/server/environment/serveEnvironmentState.test.ts src/server/environment/environmentCapacity.test.ts src/application/environment/environmentTools.test.ts src/server/DeferredEvidenceMcpServer.test.ts src/server/ProgressiveToolCatalog.test.ts tests/boundary/mcp/outputSchemaProfile.test.ts tests/boundary/mcp/serverIdentity.test.ts tests/boundary/mcp/compactInputSchemaMcp.test.ts tests/boundary/mcp/serverWorkflowMcp.test.ts tests/boundary/mcp/environmentServeMcp.test.ts tests/boundary/mcp/contractPresentation.test.ts— all pass after the test updates. The first run had 4 expected failures (environment card and listing shape), which the updated tests now cover.npm run verify:advertised-schemas— passed; committed summary unchanged.npx oxfmt --checkon changed files — clean.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.