Skip to main content
Glama
hajifkd

inspirehep-mcp

by hajifkd

inspirehep_search_by_author

Read-onlyIdempotent

Search for high-energy physics literature on INSPIRE-HEP using author names. Filter results by year, collaboration size, and sort by citations or recency to find relevant papers.

Instructions

Search INSPIRE-HEP literature by author.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main async handler for inspirehep_search_by_author tool. Decorated with @mcp.tool, it takes AuthorSearchInput parameters, builds an author query using build_author_query, and executes the search via run_search.
    @mcp.tool(
        name="inspirehep_search_by_author",
        annotations={
            "title": "Search INSPIRE-HEP papers by author",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": True,
        },
    )
    async def inspirehep_search_by_author(params: AuthorSearchInput) -> dict[str, Any]:
        """Search INSPIRE-HEP literature by author."""
    
        query = build_author_query(params.author, params.large_collaboration, params.year)
        return await run_search(
            query=query,
            limit=params.limit,
            sort_by_citation=params.sort_by_citation,
        )
  • Pydantic schema for AuthorSearchInput. Defines the author field as a list of strings with validation, extends BaseSearchInput for common parameters like limit, year, large_collaboration, and sort_by_citation.
    class AuthorSearchInput(BaseSearchInput):
        author: list[str] = Field(
            ...,
            min_length=1,
            max_length=10,
            description="Author names to search (e.g. ['Witten, Edward', 'Maldacena, Juan']).",
        )
    
        @field_validator("author")
        @classmethod
        def validate_author_list(cls, value: list[str]) -> list[str]:
            cleaned = [item.strip() for item in value]
            if any(not item for item in cleaned):
                raise ValueError("author entries must be non-empty strings.")
            return cleaned
  • Tool registration decorator that registers inspirehep_search_by_author with MCP. Sets tool name, title description, and hints (readOnly, idempotent, etc.).
    @mcp.tool(
        name="inspirehep_search_by_author",
        annotations={
            "title": "Search INSPIRE-HEP papers by author",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": True,
        },
  • Helper function that builds the INSPIRE-HEP query string from a list of author names. Escapes quotes and joins author clauses with 'and', then applies year and collaboration filters.
    def build_author_query(
        authors: list[str], large_collaboration: bool, year: int | None = None
    ) -> str:
        clauses = [f'author "{_escape_quotes(author)}"' for author in authors]
        base_query = " and ".join(clauses)
        return _apply_filters(base_query, large_collaboration, year)
  • Helper function that executes the search query using InspireHEPClient. Handles HTTP errors, converts sort preference, and returns formatted results with record count and list.
    async def run_search(
        *,
        query: str,
        limit: int,
        sort_by_citation: bool,
        client: InspireHEPClient | None = None,
    ) -> dict[str, Any]:
        sort = _to_inspire_sort(sort_by_citation)
        try:
            if client is not None:
                search_result = await client.search_literature(query=query, limit=limit, sort=sort)
            else:
                async with InspireHEPClient() as default_client:
                    search_result = await default_client.search_literature(
                        query=query,
                        limit=limit,
                        sort=sort,
                    )
        except httpx.HTTPStatusError as exc:
            status = exc.response.status_code
            message = exc.response.text or "No response body."
            raise RuntimeError(
                f"INSPIRE API error ({status}): {message[:300]}"
            ) from exc
        except httpx.HTTPError as exc:
            raise RuntimeError(f"INSPIRE API request failed: {exc}") from exc
    
        return {
            "count": len(search_result.records),
            "records": search_result.records,
        }
Behavior3/5

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

Annotations provide readOnlyHint=true, openWorldHint=true, idempotentHint=true, and destructiveHint=false, covering safety and behavior. The description adds no behavioral context beyond this (e.g., rate limits, authentication needs, or what 'search' entails like pagination). However, it doesn't contradict annotations, so it meets the lower bar with annotations present.

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 with no wasted words. It's front-loaded with the core purpose, making it easy to scan and understand quickly, though it lacks depth due to its brevity.

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 has an output schema (which handles return values), annotations cover behavioral traits, but schema description coverage is 0% and the description doesn't explain parameters or usage context. For a search tool with 1 parameter (though nested with multiple fields), the description is incomplete, failing to guide on input semantics or sibling differentiation.

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

Parameters1/5

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

Schema description coverage is 0%, meaning parameters are undocumented in the schema. The description provides no information about parameters (e.g., what 'author' expects, how to format names, or details on other inputs like 'limit' or 'year'). It fails to compensate for the lack of schema documentation, leaving parameters semantically unclear.

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

Purpose3/5

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

The description 'Search INSPIRE-HEP literature by author' clearly states the action (search) and resource (INSPIRE-HEP literature), but it's vague about scope and doesn't distinguish from siblings like inspirehep_search_by_fulltext or inspirehep_search_by_title. It doesn't specify what 'by author' means operationally (e.g., author names vs. IDs).

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 on when to use this tool versus the sibling tools (inspirehep_search_by_fulltext, inspirehep_search_by_title). The description implies it's for author-based searches, but there's no explicit comparison or context for choosing among search methods, nor any mention of prerequisites or limitations.

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/hajifkd/inspirehep-mcp'

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