Repository navigation
fix(mcp): analyze_search year window, no-extra default and speed; real-world tests - #381
Merged
Merged
Conversation
…l-world tests Found by running analyze_search against the live Europe PMC: - records dated in the future (2096) pushed the 60-year window out of range, so millions of records fell into one "before" bucket: the years now end with the current year and later-dated records are one "after" bucket - without pandas (a plain uvx install) the default call failed outright: it now returns the counted metrics and marks the others basis "unavailable" - 60 yearly counts took ~40 s through the shared client: each worker thread counts through a client of its own (~24 s) - real-world tests: exact numbers vs independent counts, paper resources vs the tool on real articles, the bearer token on a real socket Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 15 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #381 +/- ##
==========================================
+ Coverage 82.46% 82.47% +0.01%
==========================================
Files 216 216
Lines 32931 32966 +35
Branches 5952 5957 +5
==========================================
+ Hits 27156 27190 +34
- Misses 4490 4491 +1
Partials 1285 1285
|
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
Real-world testing of the released MCP features (4.4.0, installed fresh from PyPI) against the live Europe PMC and a real HTTP client. Most claims held: every
exactnumber ofanalyze_searchequalled an independent count, the paper resources matched the tool on real articles (including the non-open-access and unknown-id errors), and the bearer token was enforced on both HTTP transports with the official MCP client. Three things inanalyze_searchdid not:by_year. Europe PMC holds records dated far ahead (2096). On a live search forcancerthe 60-year window ended there, so 5.6 million records fell into onebeforebucket and the years shown were meaningless. The years now end with the current year; later-dated records are oneafterbucket (years + before + after + undated == hit_count). Live: 1967-2026, 123 records after, 119,956 before.uvx pyeuropepmc mcp(the registry's install command) has noanalyticsextra, and the defaultmetricsincludes the sample ones, soanalyze_search(query)raised. It now returnsby_year,open_accessand the citation thresholds and marks the othersbasis: unavailablewith the install hint; naming a sample metric still fails with that hint.cancer.New real-world tests (
tests/mcp/e2e/test_mcp_real_world.py,-m e2e, 9 tests, ~3 min): exact numbers vs independentcount_papersqueries (years, open access,CITEDthresholds, max citations), the 2096 case, complete-sample exactness, no-hit queries, the three resources vs the tool, and the bearer token on a real socket (session id alone is not enough).Other real-world findings are fixed in #380 (they need its changes):
rate_limit_delaywas never applied by the HTTP source clients,unified_search(sources=[...])skipped sources outside the default set, and swallowed provider failures looked like empty sources.Test plan
mypy src/: no issues in 220 files🤖 Generated with Claude Code