Skip to content

fix(mcp-server): route topgun_search through hybrid/RRF — honest search (SPEC-302)#44

Merged
ivkan merged 4 commits into
mainfrom
sf-449-mcp-hybrid-search
Jun 10, 2026
Merged

fix(mcp-server): route topgun_search through hybrid/RRF — honest search (SPEC-302)#44
ivkan merged 4 commits into
mainfrom
sf-449-mcp-hybrid-search

Conversation

@ivkan

@ivkan ivkan commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

SPEC-302 (TODO-449) — make the MCP topgun_search tool honest. It advertised "hybrid"
search but ran BM25-only. This routes it through the hybrid/RRF path and exposes the
search methods to agents.

Changes

  • packages/mcp-server/src/tools/search.ts — route topgun_search through
    hybridSearch (RRF-combined scores), honest tool description, methods routing.
  • packages/mcp-server/src/schemas.ts + types.ts — add methods param to
    SearchArgsSchema / toolSchemas.search / SearchToolArgs.
  • packages/mcp-server/README.md — corrected description.
  • packages/mcp-server/src/__tests__/tools.test.ts — extend MockTopGunClient with
    hybridSearch; "does-what-it-advertises" + per-method-score + semantic-rejection +
    FTS-not-enabled error-branch coverage.

Verification

Reviewed via the SpecFlow impl-review gate (review minors applied). CI gate is
Build · Test · Lint (mcp-server is TS); must be green before merge.

ivkan added 4 commits June 10, 2026 15:38
…ch, and SearchToolArgs

Adds optional `methods: Array<'exact' | 'fullText' | 'semantic'>` (default ['fullText'])
to the Zod schema, hand-written JSON-Schema mirror, and SearchToolArgs interface in
lock-step. No new `k` schema param — existing `limit` maps to hybridSearch's `k` internally.
…ption, methods routing, RRF scores

Handler now calls ctx.client.hybridSearch(...) instead of ctx.client.search(...), forwarding
the validated methods array (default ['fullText']) and mapping limit->k. Per-method
methodScores are rendered in each result line. Error transparency: semantic-rejection
surfaces an actionable message telling the agent to retry without the semantic leg.
FTS-not-enabled and allowed-maps checks preserved. Module header and tool description
updated to accurately describe tri-hybrid RRF search. README topgun_search entry corrected
to describe actual tri-hybrid capability with methods/limit/minScore documentation.
…t-it-advertises + per-method-score tests

Adds hybridSearch() mock method + hybridSearchResults/lastHybridSearchOptions fields to
MockTopGunClient so tests assert the hybrid path is taken, not the BM25 search path.
Adds two new tests: one asserts the default-methods case routes through hybridSearch with
methods:['fullText']; one asserts custom methods=['exact','fullText'] are forwarded and the
per-method score breakdown is rendered in output. Adapts the four pre-existing handleSearch
tests to the hybrid result shape (methodScores replaces matchedTerms).
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deploying topgun with  Cloudflare Pages  Cloudflare Pages

Latest commit: 78098ff
Status: ✅  Deploy successful!
Preview URL: https://9cdcbf50.topgun-f45.pages.dev
Branch Preview URL: https://sf-449-mcp-hybrid-search.topgun-f45.pages.dev

View logs

@ivkan ivkan merged commit e8499b6 into main Jun 10, 2026
6 checks passed
@ivkan ivkan deleted the sf-449-mcp-hybrid-search branch June 10, 2026 13:11
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.

1 participant