Skip to main content
Glama
openags

Paper Search MCP

by openags

search_pmc

Search academic papers from PubMed Central using queries to find relevant research articles and return paper metadata.

Instructions

Search academic papers from PubMed Central (PMC).

Args: query: Search query string (e.g., 'machine learning'). max_results: Maximum number of papers to return (default: 10). Returns: List of paper metadata in dictionary format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
max_resultsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `search_pmc` tool handler in the MCP server calls the `async_search` utility using the `pmc_searcher` instance.
    async def search_pmc(query: str, max_results: int = 10) -> List[Dict]:
        """Search academic papers from PubMed Central (PMC).
    
        Args:
            query: Search query string (e.g., 'machine learning').
            max_results: Maximum number of papers to return (default: 10).
        Returns:
            List of paper metadata in dictionary format.
        """
        papers = await async_search(pmc_searcher, query, max_results)
        return papers if papers else []
  • The actual PMC search logic is implemented within the `PMCSearcher.search` method, which utilizes PubMed's E-utilities API to query and parse paper data.
    def search(self, query: str, max_results: int = 10, **kwargs) -> List[Paper]:
        """
        Search PMC open access articles.
    
        Args:
            query: Search query string
            max_results: Maximum results to return
            **kwargs: Additional parameters (e.g., from_date, to_date)
    
        Returns:
            List[Paper]: List of found papers with metadata
        """
        papers = []
    
        try:
            # Step 1: Use E-utilities to search PMC database
            search_params = {
                'db': 'pmc',
                'term': query,
                'retmax': max_results,
                'retmode': 'xml',
                'tool': 'paper-search-mcp',
                'email': 'openags@example.com'
            }
    
            search_response = self.session.get(self.EUTILS_SEARCH_URL, params=search_params, timeout=30)
            search_response.raise_for_status()
            search_root = ET.fromstring(search_response.content)
    
            # Get PMC IDs
            pmcids = [id_elem.text for id_elem in search_root.findall('.//Id') if id_elem.text]
            if not pmcids:
                logger.info(f"No PMC results found for query: {query}")
                return papers
    
            # Step 2: Fetch compact summaries (more stable than full-text efetch)
            summary_params = {
                'db': 'pmc',
                'id': ','.join(pmcids),
                'retmode': 'xml',
                'tool': 'paper-search-mcp',
                'email': 'openags@example.com'
            }
    
            summary_response = self.session.get(self.EUTILS_SUMMARY_URL, params=summary_params, timeout=30)
            summary_response.raise_for_status()
            summary_root = ET.fromstring(summary_response.content)
    
            # Step 3: Parse each summary record
            for docsum in summary_root.findall('.//DocSum'):
                try:
                    paper = self._parse_docsum(docsum)
                    if paper:
                        papers.append(paper)
                        if len(papers) >= max_results:
                            break
                except Exception as e:
                    logger.warning(f"Error parsing PMC summary: {e}")
                    continue
    
        except requests.RequestException as e:
            logger.error(f"PMC search request error: {e}")
        except ET.ParseError as e:
            logger.error(f"PMC XML parsing error: {e}")
        except Exception as e:
            logger.error(f"Unexpected error in PMC search: {e}")
    
        return papers
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the return format ('List of paper metadata in dictionary format') which is helpful, but doesn't disclose important behavioral traits like rate limits, authentication requirements, whether results are paginated, what fields are included in metadata, or any limitations of the PMC search. For a search tool with no annotation coverage, this is insufficient.

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 efficiently structured with clear sections (Args, Returns) and uses minimal, purposeful sentences. Every sentence adds value: the first establishes purpose, the next two explain parameters, and the last describes return format. No wasted words.

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

Completeness3/5

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

The description covers basic purpose and parameters adequately, and an output schema exists (so return values don't need explanation). However, for a search tool with no annotations and many similar sibling tools, it lacks important context about when to use it, behavioral constraints, and differentiation from alternatives. The presence of an output schema raises the baseline, but gaps remain.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It successfully explains both parameters: 'query' as a search query string with an example, and 'max_results' with its default value. This provides meaningful semantic context beyond the bare schema, though it doesn't elaborate on query syntax or result limitations.

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 academic papers from PubMed Central (PMC), specifying both the action (search) and resource (academic papers from PMC). However, it doesn't explicitly differentiate from sibling tools like search_pubmed or search_europepmc, which likely search similar biomedical literature sources.

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 is provided about when to use this tool versus alternatives. With many sibling search tools (search_pubmed, search_europepmc, search_papers, etc.), the description doesn't explain what makes PMC unique or when it's the appropriate choice compared to other biomedical literature search tools.

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/openags/paper-search-mcp'

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