perf(mcp): trim default max_results to match real task needs#476
Merged
Conversation
…earch, 50→30 callers)
The defaults were set when the MCP envelope was newer and we didn't know
what agents actually consumed. Bench eval data (16 tasks × 4 corpora
across react/regex/flask/gin) showed the median answer needed under 10
results — the extra 40 were paid in tokens on every call without
contributing to quality.
Measured impact on react via the MCP envelope:
- search 'useEffect': 932 → 645 tokens (-31%)
- search 'scheduleCallback': → 584 tokens
- search 'CompleteWork': → 287 tokens
- callers 'useState': → 980 tokens
Agents that want broader surveys can still pass max_results explicitly.
Description text updated to surface the lever ("default: 20, raise to 50
for broad surveys").
This closes part of the gap with codegraph on per-call tokens while
keeping codedb's quality + wall-time wins intact.
Benchmark Regression ReportThresholds: 10.00% and 50,000 ns absolute delta
|
This was referenced May 20, 2026
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
The MCP defaults for
codedb_searchandcodedb_callerswere 50 — generous, but bench data from the code-search-shootout eval (16 tasks × 4 corpora) showed the median answer needed fewer than 10 results. The extra 40 were paid in tokens on every call without contributing to answer quality.codedb_search: defaultmax_results50 → 20 (description: "default: 20, raise to 50 for broad surveys")codedb_callers: defaultmax_results50 → 30 (description: "default: 30, raise for hot symbols")Agents that genuinely need a broad survey can still pass
max_resultsexplicitly. The lower default just stops paying the survey cost on every query.Measured impact (react corpus, via MCP envelope)
search 'useEffect'search 'scheduleCallback'search 'CompleteWork'callers 'useState'At the bench average of 6.5 codedb tool calls per task, that's ≈1.8k tokens shaved per task — closing the per-task gap with codegraph (6.9k tokens avg vs codedb's 16.7k) without touching codedb's quality (4.70/5) or wall-time (16.6s) leadership.
Test plan
zig build(ReleaseFast) passeszig build test— 486/487 pass (1 failing test is pre-existing onmain:issue-44)max_results=50still returns 50codedb_find,codedb_word,codedb_outline,codedb_status