Add rerank parameter to MCP query tool

The MCP query tool always ran LLM reranking, even for lex-only queries.
On CPU-only infrastructure (e.g. Railway), the reranker adds 60-120s
per query. The SDK and CLI already support skipping reranking, but the
MCP server did not expose this option.

Add a `rerank` boolean parameter (default: true) to the MCP query
tool's input schema, forwarded to store.search() as the existing
`rerank` option.

Fixes #477

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Niven 2026-03-27 13:10:31 -07:00
parent 2b8f329d7e
commit 792992ef65

View File

@ -296,9 +296,12 @@ Intent-aware lex (C++ performance, not sports):
intent: z.string().optional().describe(
"Background context to disambiguate the query. Example: query='performance', intent='web page load times and Core Web Vitals'. Does not search on its own."
),
rerank: z.boolean().optional().default(true).describe(
"Rerank results using LLM (default: true). Set to false for faster results on CPU-only machines."
),
},
},
async ({ searches, limit, minScore, candidateLimit, collections, intent }) => {
async ({ searches, limit, minScore, candidateLimit, collections, intent, rerank }) => {
// Map to internal format
const queries: ExpandedQuery[] = searches.map(s => ({
type: s.type,
@ -313,6 +316,7 @@ Intent-aware lex (C++ performance, not sports):
collections: effectiveCollections.length > 0 ? effectiveCollections : undefined,
limit,
minScore,
rerank,
intent,
});