refactor: address review feedback - generic sort, remove unrelated CORS header#2517
Closed
SamMorrowDrums wants to merge 1 commit into
Closed
Conversation
- Remove unrelated X-Custom-Auth-Headers from CORS allowlist - Replace per-type sort functions with generic sortByToolset[T] - Add doc comments explaining why WithoutFeatureFiltering is needed (HTTP mode feature flags arrive per-request, so static schema must include all variants as an upper bound) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses review feedback from #2450 by simplifying deterministic sorting logic in the inventory layer, tightening the HTTP CORS allowlist by removing an unrelated header, and documenting why the “without feature filtering” inventory accessors are required for HTTP static schema generation.
Changes:
- Replace three per-type deterministic sort helpers with a single generic
sortByToolset[T]used for tools, resource templates, and prompts. - Remove
X-Custom-Auth-Headersfrom the HTTP CORSAccess-Control-Allow-Headerslist. - Expand doc comments on
Available*WithoutFeatureFilteringmethods to clarify their role in HTTP static schema generation with per-request feature flags (X-MCP-Features).
Show a summary per file
| File | Description |
|---|---|
| pkg/inventory/filters.go | Introduces a generic toolset/name sorter and documents why feature-flagged variants must be preserved for HTTP static schema. |
| pkg/http/middleware/cors.go | Removes an unused/unrelated CORS-allowed header from the allowlist. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
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
Addresses review feedback from PR #2450.
Changes
X-Custom-Auth-Headersfrom CORS — unrelated to CSV output, not on mainsortByToolset[T]— replaces 3 per-type sort functions (sortTools,sortResourceTemplates,sortPrompts) with a single generic, as suggested in reviewWithoutFeatureFilteringmethods — explains why these are needed: HTTP mode receives feature flags per-request viaX-MCP-Featuresheader, so the static schema must include all feature-gated variants as an upper boundContext
The
WithoutFeatureFilteringmethods ARE needed for the HTTP handler'sstaticSchemaTools. Without them, the static MCP schema would only include the non-flagged variant, and clients sendingX-MCP-Features: csv_outputwould have no tool to invoke. The per-request inventory narrows to the correct variant at call time.