find_reviews
Retrieve systematic reviews and meta-analyses from PubMed filtered by relevance to a query.
Instructions
Search PubMed for systematic reviews and meta-analyses only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| max_results | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:60-64 (handler)The handler function for the 'find_reviews' MCP tool. It filters PubMed searches to systematic reviews and meta-analyses by appending a filter to the query and delegating to search_pubmed.
async def find_reviews(query: str, max_results: int = 10) -> str: """Search PubMed for systematic reviews and meta-analyses only.""" return await search_pubmed( f"{query} AND (systematic review[pt] OR meta-analysis[pt])", max_results ) - server.py:59-59 (registration)The '@mcp.tool()' decorator that registers 'find_reviews' as an MCP tool with FastMCP.
@mcp.tool() - server.py:60-63 (schema)The function signature defines the input schema: 'query: str' (required) and 'max_results: int = 10' (optional with default). The return type annotation '-> str' defines the output schema.
async def find_reviews(query: str, max_results: int = 10) -> str: """Search PubMed for systematic reviews and meta-analyses only.""" return await search_pubmed( f"{query} AND (systematic review[pt] OR meta-analysis[pt])", max_results - server.py:8-26 (helper)The 'search_pubmed' helper function that 'find_reviews' delegates to. It performs the actual PubMed E-utilities API call (esearch + esummary) and returns formatted results.
@mcp.tool() async def search_pubmed(query: str, max_results: int = 10) -> str: """Search PubMed by keyword, MeSH term, or author. Returns PMIDs and titles.""" async with httpx.AsyncClient() as client: r = await client.get(f"{PUBMED_BASE}/esearch.fcgi", params={ "db": "pubmed", "term": query, "retmax": max_results, "retmode": "json" }) data = r.json() ids = data["esearchresult"]["idlist"] r2 = await client.get(f"{PUBMED_BASE}/esummary.fcgi", params={ "db": "pubmed", "id": ",".join(ids), "retmode": "json" }) summaries = r2.json()["result"] results = [] for pmid in ids: title = summaries[pmid]["title"] results.append(f"PMID {pmid}: {title}") return "\n".join(results)