fix(mcp-server): route topgun_search through hybrid/RRF — honest search (SPEC-302)#44
Merged
Conversation
…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).
…on and FTS-not-enabled error branches
Deploying topgun with
|
| 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 |
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
SPEC-302 (TODO-449) — make the MCP
topgun_searchtool 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— routetopgun_searchthroughhybridSearch(RRF-combined scores), honest tool description, methods routing.packages/mcp-server/src/schemas.ts+types.ts— addmethodsparam toSearchArgsSchema/toolSchemas.search/SearchToolArgs.packages/mcp-server/README.md— corrected description.packages/mcp-server/src/__tests__/tools.test.ts— extend MockTopGunClient withhybridSearch; "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.