Skip to main content
Glama
prtc
by prtc

search_papers

Search NASA ADS for astronomy and astrophysics papers using natural language or field-specific queries to find relevant research with publication details and citation metrics.

Instructions

Search NASA ADS for astronomy/astrophysics papers. Returns bibcodes, titles, authors, years, and citation counts. Use natural language queries or specific field searches. Examples: 'stellar populations', 'author:Coelho', 'year:2020-2024'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (e.g., 'stellar populations in elliptical galaxies')
max_resultsNoMaximum number of results to return (default: 10, max: 50)
sortNoSort order: 'date' (newest first), 'citation_count' (most cited), or 'relevance'date

Implementation Reference

  • The handler function that executes the search_papers tool. It queries the NASA ADS using the ads library, formats the results with titles, authors, years, citations, and bibcodes, and returns them as TextContent.
    async def search_papers(query: str, max_results: int, sort: str) -> list[TextContent]:
        """Search ADS for papers."""
        try:
            # Prepare sort parameter for ADS
            sort_map = {
                "date": "date desc",
                "citation_count": "citation_count desc",
                "relevance": "score desc",
            }
            
            # Perform search
            papers = ads.SearchQuery(
                q=query,
                fl=["bibcode", "title", "author", "year", "citation_count", "pubdate"],
                rows=min(max_results, 50),
                sort=sort_map.get(sort, "date desc"),
            )
            
            # Format results
            results = []
            for i, paper in enumerate(papers, 1):
                authors = paper.author[:3] if paper.author else ["Unknown"]
                author_str = ", ".join(authors)
                if paper.author and len(paper.author) > 3:
                    author_str += f" et al. ({len(paper.author)} authors)"
                
                results.append(
                    f"{i}. {paper.title[0] if paper.title else 'No title'}\n"
                    f"   Authors: {author_str}\n"
                    f"   Year: {paper.year}\n"
                    f"   Citations: {paper.citation_count or 0}\n"
                    f"   Bibcode: {paper.bibcode}\n"
                )
            
            if not results:
                return [TextContent(
                    type="text",
                    text=f"No papers found for query: {query}"
                )]
            
            response = f"Found {len(results)} papers for '{query}':\n\n" + "\n".join(results)
            return [TextContent(type="text", text=response)]
        
        except Exception as e:
            logger.error(f"Error searching papers: {e}")
            return [TextContent(
                type="text",
                text=f"Error searching papers: {str(e)}"
            )]
  • Pydantic-like input schema defining parameters for the search_papers tool: query (required string), max_results (int, default 10), sort (enum: date, citation_count, relevance, default date).
    inputSchema={
        "type": "object",
        "properties": {
            "query": {
                "type": "string",
                "description": "Search query (e.g., 'stellar populations in elliptical galaxies')",
            },
            "max_results": {
                "type": "integer",
                "description": "Maximum number of results to return (default: 10, max: 50)",
                "default": 10,
            },
            "sort": {
                "type": "string",
                "description": "Sort order: 'date' (newest first), 'citation_count' (most cited), or 'relevance'",
                "enum": ["date", "citation_count", "relevance"],
                "default": "date",
            },
        },
        "required": ["query"],
    },
  • Registers the search_papers tool in the MCP server's list_tools() function, providing name, description, and input schema.
    Tool(
        name="search_papers",
        description=(
            "Search NASA ADS for astronomy/astrophysics papers. "
            "Returns bibcodes, titles, authors, years, and citation counts. "
            "Use natural language queries or specific field searches. "
            "Examples: 'stellar populations', 'author:Coelho', 'year:2020-2024'"
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "query": {
                    "type": "string",
                    "description": "Search query (e.g., 'stellar populations in elliptical galaxies')",
                },
                "max_results": {
                    "type": "integer",
                    "description": "Maximum number of results to return (default: 10, max: 50)",
                    "default": 10,
                },
                "sort": {
                    "type": "string",
                    "description": "Sort order: 'date' (newest first), 'citation_count' (most cited), or 'relevance'",
                    "enum": ["date", "citation_count", "relevance"],
                    "default": "date",
                },
            },
            "required": ["query"],
        },
    ),
  • Tool dispatching logic in the call_tool handler that routes search_papers calls to the implementation function with parsed arguments.
    if name == "search_papers":
        return await search_papers(
            query=arguments["query"],
            max_results=arguments.get("max_results", 10),
            sort=arguments.get("sort", "date"),
        )
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes what the tool returns (bibcodes, titles, authors, years, citation counts) and provides query format examples, which adds useful context. However, it doesn't mention potential limitations like rate limits, authentication needs, or error conditions that would be important for a search tool.

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 appropriately sized and front-loaded: the first sentence states the core purpose, the second explains what's returned, and the third provides usage guidance with examples. Every sentence earns its place with no wasted words, making it efficient and easy to parse.

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?

Given the tool's moderate complexity (search with 3 parameters), no annotations, and no output schema, the description does a good job covering the essentials: purpose, return values, and usage examples. However, it could be more complete by mentioning output format details or potential constraints since there's no output schema to document the response structure.

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 already documents all three parameters thoroughly. The description adds some value by providing query examples ('stellar populations', 'author:Coelho', 'year:2020-2024') that illustrate parameter usage, but doesn't add significant semantic information beyond what's in the schema descriptions. This meets the baseline for high schema coverage.

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?

The description clearly states the tool's purpose with specific verb ('Search') and resource ('NASA ADS for astronomy/astrophysics papers'), and distinguishes it from siblings like 'get_paper_details' or 'get_author_papers' by focusing on search functionality. It specifies the scope (astronomy/astrophysics) and what information is returned (bibcodes, titles, authors, years, citation counts).

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 description provides clear context on when to use this tool by explaining it handles 'natural language queries or specific field searches' and gives examples like 'stellar populations', 'author:Coelho', 'year:2020-2024'. However, it doesn't explicitly state when not to use it or name specific alternatives among siblings (e.g., 'get_author_papers' for author-specific queries).

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/prtc/nasa-ads-mcp'

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