Skip to main content
Glama
DaniManas
by DaniManas

search_papers

Find academic papers on OpenAlex by entering research topics or keywords, with options to filter by year and limit results for focused literature review.

Instructions

Search for academic papers on OpenAlex based on a query.

Args: query: The research topic or keywords to search for max_results: Maximum number of papers to return (default: 5) year_from: Only include papers from this year onwards (optional)

Returns: A formatted string with paper details including titles, authors, citations, and URLs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
max_resultsNo
year_fromNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main MCP tool handler for 'search_papers', registered via @mcp.tool(). Handles input parameters, calls the PaperFetcher helper to search OpenAlex API, formats results into a markdown string with paper details.
    @mcp.tool()
    def search_papers(query: str, max_results: int = 5, year_from: Optional[int] = None) -> str:
        """
        Search for academic papers on OpenAlex based on a query.
    
        Args:
            query: The research topic or keywords to search for
            max_results: Maximum number of papers to return (default: 5)
            year_from: Only include papers from this year onwards (optional)
    
        Returns:
            A formatted string with paper details including titles, authors, citations, and URLs
        """
        papers = fetcher.search_papers(
            query=query,
            max_results=max_results,
            year_from=year_from
        )
    
        if papers and "error" in papers[0]:
            return papers[0]["error"]
    
        if not papers:
            return f"No papers found for query: {query}"
    
        result = f"Found {len(papers)} papers for '{query}':\n\n"
    
        for i, paper in enumerate(papers, 1):
            result += f"{i}. **{paper['title']}**\n"
            result += f"   Authors: {paper['authors']}\n"
            result += f"   Year: {paper['publication_year']}\n"
            result += f"   Citations: {paper['cited_by_count']}\n"
            result += f"   URL: {paper['url']}\n"
            result += f"   ID: {paper['id']}\n\n"
    
        return result
  • Supporting utility method in PaperFetcher class that implements the core logic: constructs OpenAlex API request for paper search, handles HTTP calls, parses responses into standardized paper dictionaries using _parse_paper.
    def search_papers(
        self,
        query: str,
        max_results: int = 5,
        sort_by: str = "cited_by_count",
        year_from: Optional[int] = None
    ) -> List[Dict]:
        """
        Search for papers on OpenAlex.
    
        Args:
            query: Search keywords
            max_results: Maximum number of results
            sort_by: Sort by 'cited_by_count', 'publication_date', or 'relevance'
            year_from: Only papers from this year onwards
    
        Returns:
            List of paper dictionaries with title, authors, abstract, etc.
        """
        url = f"{self.BASE_URL}/works"
    
        params = {
            "search": query,
            "per_page": max_results,
            "sort": sort_by + ":desc"
        }
    
        if year_from:
            params["filter"] = f"publication_year:>{year_from-1}"
    
        try:
            response = self.client.get(url, params=params)
            response.raise_for_status()
            data = response.json()
    
            papers = []
            for work in data.get("results", []):
                paper = self._parse_paper(work)
                papers.append(paper)
    
            return papers
    
        except httpx.HTTPError as e:
            return [{"error": f"Failed to fetch papers: {str(e)}"}]
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. It mentions the tool 'searches' and 'returns' formatted strings, implying a read-only operation, but lacks details on behavioral traits such as rate limits, authentication needs, error handling, or whether it performs destructive actions. The description doesn't compensate for the absence of annotations.

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 well-structured and appropriately sized, with a clear purpose statement followed by 'Args' and 'Returns' sections. Each sentence adds value, such as explaining defaults and optional parameters, though it could be slightly more front-loaded by integrating key details into the opening sentence.

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?

Given the complexity (a search tool with 3 parameters), no annotations, and an output schema present (implied by 'Returns'), the description is moderately complete. It covers basic functionality and parameters but lacks context on usage guidelines, behavioral transparency, and deeper parameter semantics, leaving gaps for an AI agent to infer correctly.

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?

The description adds some meaning beyond the input schema by explaining that 'query' is for 'research topic or keywords', 'max_results' has a default of 5, and 'year_from' filters papers 'from this year onwards'. However, with 0% schema description coverage and 3 parameters, it only partially compensates—e.g., it doesn't detail query syntax, result ordering, or validation rules for parameters.

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: 'Search for academic papers on OpenAlex based on a query.' It specifies the verb ('search'), resource ('academic papers'), and platform ('OpenAlex'). However, it doesn't explicitly differentiate from sibling tools like 'find_research_gaps' or 'get_citations', which may also involve paper searching but with different scopes or purposes.

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 'find_research_gaps' and 'get_citations', there's no indication of when this general search tool is preferred over more specific ones, nor does it mention prerequisites or exclusions for usage.

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/DaniManas/ResearchMCP'

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