Skip to main content
Glama

get_article

Retrieve complete metadata for PubMed articles using PMIDs to access titles, authors, abstracts, and publication details for biomedical research.

Instructions

Get complete details of a PubMed article by its PMID.

Args: pmid: The PubMed ID (numeric string), e.g. "33982811".

Returns: Full article metadata: title, all authors, journal, date, DOI, PMC link, publication types, full abstract, keywords, MeSH terms. Returns an error message if the PMID is invalid or not found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pmidYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:374-442 (handler)
    Implementation of the `get_article` tool handler using the FastMCP decorator. It takes a PMID as input, queries the NCBI E-utilities API, and formats the response.
    @mcp.tool()
    async def get_article(pmid: str) -> str:
        """Get complete details of a PubMed article by its PMID.
    
        Args:
            pmid: The PubMed ID (numeric string), e.g. "33982811".
    
        Returns:
            Full article metadata: title, all authors, journal, date, DOI,
            PMC link, publication types, full abstract, keywords, MeSH terms.
            Returns an error message if the PMID is invalid or not found.
        """
        pmid = pmid.strip()
        if not pmid.isdigit():
            return _err(f"Invalid PMID: {pmid!r}. A PMID must be a numeric string.")
    
        try:
            fetch_resp = await _get(
                "efetch.fcgi",
                {"db": "pubmed", "id": pmid, "retmode": "xml", "rettype": "abstract"},
            )
            root = _require_xml(fetch_resp, f"efetch PMID {pmid}")
            article_xml = root.find(".//PubmedArticle")
    
            if article_xml is None:
                return _err(f"No article found for PMID {pmid}. It may not exist or may have been retracted.")
    
            art = _parse_article(article_xml)
    
            lines = [f"=== PubMed Article — PMID {pmid} ==="]
            lines.append(f"Title    : {art.get('title', 'N/A')}")
    
            authors = art.get("authors", [])
            if authors:
                lines.append(f"Authors  : {', '.join(authors)}")
    
            lines.append(f"Journal  : {art.get('journal', 'N/A')}")
            lines.append(f"Published: {art.get('pub_date', 'N/A')}")
    
            if "doi" in art:
                lines.append(f"DOI      : {art['doi']}")
                lines.append(f"DOI URL  : https://doi.org/{art['doi']}")
    
            if "pmc_id" in art:
                pmc_id = art["pmc_id"]
                lines.append(f"PMC ID   : {pmc_id}")
                lines.append(f"PMC URL  : https://www.ncbi.nlm.nih.gov/pmc/articles/{pmc_id}/")
    
            lines.append(f"PubMed   : https://pubmed.ncbi.nlm.nih.gov/{pmid}/")
    
            if "publication_types" in art:
                lines.append(f"Type(s)  : {', '.join(art['publication_types'])}")
    
            if "abstract" in art:
                lines.append(f"\nAbstract:\n{art['abstract']}")
            else:
                lines.append("\nAbstract: Not available.")
    
            if "keywords" in art:
                lines.append(f"\nKeywords : {', '.join(art['keywords'])}")
    
            if "mesh_terms" in art:
                lines.append(f"\nMeSH     : {', '.join(art['mesh_terms'])}")
    
            return "\n".join(lines)
    
        except PubMedError as exc:
            return _err(str(exc))
Behavior4/5

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

With no annotations provided, the description carries the full burden and successfully discloses error behavior ('Returns an error message if the PMID is invalid or not found'). Lacks mention of rate limits or authentication requirements, but covers the critical failure mode.

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

Conciseness5/5

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

Uses a structured docstring format (Args/Returns) with zero waste. The first sentence establishes purpose, followed by precise parameter documentation and return value specification. Every sentence earns its place.

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

Completeness4/5

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

For a single-parameter lookup tool, the description is comprehensive: it documents the input parameter (compensating for schema gaps), lists return fields, and specifies error behavior. Presence of output schema reduces the need for detailed return documentation, yet it provides helpful field enumeration.

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

Parameters5/5

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

Schema description coverage is 0% (parameter has no description field), but the description fully compensates by documenting the PMID parameter with semantics ('PubMed ID'), format hint ('numeric string'), and a concrete example ('33982811').

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

Purpose5/5

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

Description opens with specific verb ('Get'), resource ('PubMed article'), and scope ('complete details by its PMID'), clearly distinguishing it from sibling search tools and full-text retrieval tools.

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

Usage Guidelines4/5

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

The phrase 'by its PMID' provides clear context that this tool requires a specific identifier, implicitly distinguishing it from search_pubmed and search_by_author siblings. However, it does not explicitly name alternatives or state when to use search vs. retrieval.

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

Install Server

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/benoitleq/mcp-pubmed'

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