Skip to content

refactor: address review feedback - generic sort, remove unrelated CORS header#2517

Closed
SamMorrowDrums wants to merge 1 commit into
rosstarrant/add-csv-output-structurefrom
sammorrowdrums/congenial-lamp
Closed

refactor: address review feedback - generic sort, remove unrelated CORS header#2517
SamMorrowDrums wants to merge 1 commit into
rosstarrant/add-csv-output-structurefrom
sammorrowdrums/congenial-lamp

Conversation

@SamMorrowDrums
Copy link
Copy Markdown
Collaborator

Summary

Addresses review feedback from PR #2450.

Changes

  1. Remove X-Custom-Auth-Headers from CORS — unrelated to CSV output, not on main
  2. Generic sortByToolset[T] — replaces 3 per-type sort functions (sortTools, sortResourceTemplates, sortPrompts) with a single generic, as suggested in review
  3. Doc comments on WithoutFeatureFiltering methods — explains why these are needed: HTTP mode receives feature flags per-request via X-MCP-Features header, so the static schema must include all feature-gated variants as an upper bound

Context

The WithoutFeatureFiltering methods ARE needed for the HTTP handler's staticSchemaTools. Without them, the static MCP schema would only include the non-flagged variant, and clients sending X-MCP-Features: csv_output would have no tool to invoke. The per-request inventory narrows to the correct variant at call time.

- 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>
@SamMorrowDrums SamMorrowDrums requested a review from a team as a code owner May 21, 2026 12:33
Copilot AI review requested due to automatic review settings May 21, 2026 12:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-Headers from the HTTP CORS Access-Control-Allow-Headers list.
  • Expand doc comments on Available*WithoutFeatureFiltering methods 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants