Skip to main content
Glama

search_pubmed

Retrieve PMIDs and titles from PubMed by searching with keyword, MeSH term, or author. Control the number of results returned.

Instructions

Search PubMed by keyword, MeSH term, or author. Returns PMIDs and titles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
max_resultsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:9-26 (handler)
    The main handler for the 'search_pubmed' tool. Searches PubMed via E-utilities (esearch + esummary), returns PMIDs and titles.
    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)
  • server.py:8-8 (registration)
    Registration of 'search_pubmed' as an MCP tool via @mcp.tool() decorator.
    @mcp.tool()
  • The 'find_reviews' tool reuses search_pubmed by appending a systematic review / meta-analysis filter to the query.
    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
        )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description only states the tool searches and returns results. It lacks important behavioral details such as rate limits, data freshness, or whether the search is real-time.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with two sentences, front-loading the action. It wastes no words, though it could integrate more parameter hints without adding length.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 params, output schema exists), the description is incomplete. It fails to explain query format, default behavior, or any limits beyond max_results. The output schema is not referenced.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%. The description adds minimal context by mentioning search by 'keyword, MeSH term, or author', but does not specify query syntax or how max_results affects pagination.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches PubMed and returns PMIDs and titles, distinguishing it from siblings like find_reviews or get_abstract. However, it could be more specific about the types of queries (e.g., free text vs MeSH).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like find_reviews or get_citations. The description does not mention any prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pubspro/pubmed-search'

If you have feedback or need assistance with the MCP directory API, please join our Discord server