Skip to content

fix(mcp): build web_search provider enum dynamically and honor blocked providers (#11100) - #11120

Closed
rqzbeh wants to merge 5 commits into
cheaper-inference:release/v3.8.50from
rqzbeh:fix/mcp-web-search-provider-enum-dynamic
Closed

rqzbeh wants to merge 5 commits into
cheaper-inference:release/v3.8.50from
rqzbeh:fix/mcp-web-search-provider-enum-dynamic

Conversation

@rqzbeh

@rqzbeh rqzbeh commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #11100.

Summary

  1. Replaces the hardcoded 9-provider array in omniroute_web_search MCP tool's webSearchInput schema with z.enum(getActiveSearchProviders()).
  2. Adds getActiveSearchProviders(blockedProviders?: string[]) to open-sse/config/searchRegistry.ts, which dynamically returns active registered search provider IDs and filters out any disabled or blocked providers (via isProviderBlockedByIdOrAlias).
  3. Updates handleWebSearch in open-sse/mcp-server/server.ts signature to accept provider?: string.
  4. Adds automated contract unit test tests/unit/mcp-web-search-provider-enum-contract.test.ts.

@rqzbeh
rqzbeh requested a review from diegosouzapw as a code owner August 22, 2026 10:43
@rqzbeh
rqzbeh changed the base branch from main to release/v3.8.50 August 22, 2026 14:49
@rqzbeh
rqzbeh force-pushed the fix/mcp-web-search-provider-enum-dynamic branch from d4b39b6 to 0aeb0de Compare August 22, 2026 14:54
@rqzbeh
rqzbeh force-pushed the fix/mcp-web-search-provider-enum-dynamic branch from 0aeb0de to 5d4a6c3 Compare August 22, 2026 15:05
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Closing with credit — verified subsumed against the current tip:

Remaining known gap (filed mentally as backlog): the MCP enum is built statically at module scope, so runtime-blocked providers still appear in the schema — a real fix needs runtime-schema plumbing, which is a separate design. Thank you @rqzbeh — the endpoint half of #11100 landed through your #11125!

diegosouzapw pushed a commit that referenced this pull request Aug 22, 2026
… providers (#11100) (#11155)

Cherry-picked onto the current tip (authorship preserved), generated-count noise stripped. Two pre-merge adjustments: (1) dropped the unrelated localDb.ts re-export hunk (nothing in this PR uses those symbols); (2) automated security review flagged the blocked-provider list resolving once at server creation — the handler now rebuilds the schema per invocation via the resolver (advertised tools/list schema stays a creation-time snapshot, which is inherent to MCP). Vitest: new runtime-blocked-schema suite 3/3, full MCP __tests__ 118/118; contract suites (mcp-web-search-provider-enum-contract, search-blocked-providers-11100) 6/6; typecheck clean. This closes the residual gap noted when #11120 was closed. Thank you @rqzbeh!
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
… providers (cheaper-inference#11100) (cheaper-inference#11155)

Cherry-picked onto the current tip (authorship preserved), generated-count noise stripped. Two pre-merge adjustments: (1) dropped the unrelated localDb.ts re-export hunk (nothing in this PR uses those symbols); (2) automated security review flagged the blocked-provider list resolving once at server creation — the handler now rebuilds the schema per invocation via the resolver (advertised tools/list schema stays a creation-time snapshot, which is inherent to MCP). Vitest: new runtime-blocked-schema suite 3/3, full MCP __tests__ 118/118; contract suites (mcp-web-search-provider-enum-contract, search-blocked-providers-11100) 6/6; typecheck clean. This closes the residual gap noted when cheaper-inference#11120 was closed. Thank you @rqzbeh!
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.

[BUG] MCP omniroute_web_search provider enum exposes all 16 registry providers while GET /v1/search lists only non-blocked ones

2 participants