Skip to main content
Glama
chrismannina

PubMed MCP Server

by chrismannina

export_citations

Export PubMed article citations in formats like BibTeX, EndNote, or APA for use in research papers and reference managers.

Instructions

Export article citations in various formats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pmidsYesList of PubMed IDs to export
formatNoCitation formatbibtex
include_abstractsNoInclude abstracts in citations

Implementation Reference

  • Main handler function implementing the export_citations tool: validates PMIDs, fetches article details, formats citations using CitationFormatter, and returns MCPResponse.
    async def _handle_export_citations(self, arguments: Dict[str, Any]) -> MCPResponse:
        """Handle citation export."""
        try:
            pmids = arguments.get("pmids", [])
            if not pmids:
                return MCPResponse(
                    content=[{"type": "text", "text": "PMIDs parameter is required"}], is_error=True
                )
    
            format_type = CitationFormat(arguments.get("format", "bibtex"))
    
            # Get article details
            articles = await self.pubmed_client.get_article_details(
                pmids=pmids,
                include_abstracts=True,  # Always get abstracts for citation
                cache=self.cache,
            )
    
            if not articles:
                return MCPResponse(
                    content=[{"type": "text", "text": "No articles found for the provided PMIDs"}],
                    is_error=True,
                )
    
            # Format citations
            citations = CitationFormatter.format_multiple_citations(
                articles=articles, format_type=format_type
            )
    
            content = []
            content.append(
                {
                    "type": "text",
                    "text": f"**Citations in {format_type.value.upper()} format**\n\n{citations}",
                }
            )
    
            return MCPResponse(content=content)
    
        except Exception as e:
            logger.error(f"Error in export_citations: {e}")
            return MCPResponse(
                content=[{"type": "text", "text": f"Error: {str(e)}"}], is_error=True
            )
  • JSON schema defining the input parameters for the export_citations tool, including PMIDs (required), format (default bibtex), and include_abstracts.
    {
        "name": "export_citations",
        "description": "Export article citations in various formats",
        "inputSchema": {
            "type": "object",
            "properties": {
                "pmids": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "List of PubMed IDs to export",
                },
                "format": {
                    "type": "string",
                    "enum": ["bibtex", "endnote", "ris", "apa", "mla", "chicago", "vancouver"],
                    "default": "bibtex",
                    "description": "Citation format",
                },
                "include_abstracts": {
                    "type": "boolean",
                    "default": False,
                    "description": "Include abstracts in citations",
                },
            },
            "required": ["pmids"],
        },
    },
  • Tool handler routing map that registers 'export_citations' to its handler function _handle_export_citations.
    handler_map = {
        "search_pubmed": self._handle_search_pubmed,
        "get_article_details": self._handle_get_article_details,
        "search_by_author": self._handle_search_by_author,
        "find_related_articles": self._handle_find_related_articles,
        "export_citations": self._handle_export_citations,
        "search_mesh_terms": self._handle_search_mesh_terms,
        "search_by_journal": self._handle_search_by_journal,
        "get_trending_topics": self._handle_get_trending_topics,
        "analyze_research_trends": self._handle_analyze_research_trends,
        "compare_articles": self._handle_compare_articles,
        "get_journal_metrics": self._handle_get_journal_metrics,
        "advanced_search": self._handle_advanced_search,
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but lacks critical behavioral details: whether this is a read-only operation, if it requires authentication, rate limits, what the output looks like (e.g., file download or text), or error handling. For a tool with no annotations, this is a significant gap.

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?

The description is a single, efficient sentence that front-loads the core purpose ('Export article citations') and adds essential context ('in various formats'). There is zero waste or redundancy, making it highly concise and well-structured for quick understanding.

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 complexity (export functionality with 3 parameters) and lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like output format, permissions, or error handling, which are crucial for an export tool. The schema covers parameters well, but overall context is insufficient.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents all three parameters (pmids, format, include_abstracts). The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain format differences or pmid validation). Baseline 3 is appropriate when the schema does the heavy lifting.

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's purpose with a specific verb ('Export') and resource ('article citations'), and specifies the output domain ('various formats'). It doesn't explicitly distinguish from sibling tools like 'get_article_details' or 'search_pubmed', but the export focus is clear. No tautology or misleading elements are present.

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?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'get_article_details' and 'search_pubmed' that might retrieve citation data, there's no indication of when export is preferred (e.g., for formatted outputs vs raw data). Usage is implied by the name but not explicitly stated.

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

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