Skip to main content
Glama
smaniches

Semantic Scholar MCP Server

by smaniches

semantic_scholar_author_batch

Read-onlyIdempotent

Batch query multiple Semantic Scholar authors in a single request to retrieve up to 1000 author profiles.

Instructions

Retrieve multiple authors in a single request (max 1000).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler function for the semantic_scholar_author_batch tool. Sends a POST request to the Semantic Scholar 'author/batch' endpoint with up to 1000 author IDs. Supports JSON and Markdown response formats, tracking successful retrievals and reporting not-found IDs.
    @mcp.tool(
        name="semantic_scholar_author_batch",
        annotations=ToolAnnotations(readOnlyHint=True, idempotentHint=True, openWorldHint=True),
    )
    async def get_author_batch(params: AuthorBatchInput) -> str:
        """Retrieve multiple authors in a single request (max 1000)."""
        logger.info("Batch author retrieval: %d authors", len(params.author_ids))
    
        try:
            response = await _make_request(
                "POST",
                "author/batch",
                params={"fields": ",".join(AUTHOR_FIELDS)},
                json_body={"ids": params.author_ids},
                api_key=params.api_key,
            )
            authors = response if isinstance(response, list) else response.get("data", [])
        except SemanticScholarError as e:
            raise ToolError(str(e)) from e
    
        succeeded = [a for a in authors if a]
        failed_indices = [i for i, a in enumerate(authors) if not a]
        failed_ids = [params.author_ids[i] for i in failed_indices if i < len(params.author_ids)]
    
        if params.response_format == ResponseFormat.JSON:
            result: dict[str, Any] = {
                "requested": len(params.author_ids),
                "retrieved": len(succeeded),
                "authors": succeeded,
            }
            if failed_ids:
                result["not_found"] = failed_ids
            return json.dumps(result, indent=2)
    
        lines = [
            "## Batch Author Retrieval",
            f"**Requested:** {len(params.author_ids)} | **Retrieved:** {len(succeeded)}",
            "",
        ]
        if failed_ids:
            lines.append(f"**Not found ({len(failed_ids)}):** {', '.join(failed_ids[:20])}")
            lines.append("")
        for author in succeeded:
            lines.append(_format_author_markdown(author))
        return "\n".join(lines)
  • Pydantic input schema for AuthorBatchInput. Validates author_ids list (1-1000 items), response_format (default JSON), and optional api_key override.
    class AuthorBatchInput(BaseModel):
        model_config = ConfigDict(str_strip_whitespace=True, extra="forbid")
        author_ids: list[str] = Field(
            ..., description="List of author IDs (max 1000)", min_length=1, max_length=1000
        )
        response_format: ResponseFormat = Field(
            default=ResponseFormat.JSON, description="Output format"
        )
        api_key: str | None = Field(
            default=None,
            description="API key (overrides SEMANTIC_SCHOLAR_API_KEY env var)",
        )
  • Registration of the 'semantic_scholar_author_batch' tool using the @mcp.tool decorator with readOnlyHint, idempotentHint, and openWorldHint annotations.
    @mcp.tool(
        name="semantic_scholar_author_batch",
        annotations=ToolAnnotations(readOnlyHint=True, idempotentHint=True, openWorldHint=True),
    )
Behavior4/5

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

Annotations already declare readOnly, idempotent, and open-world hints. The description adds the batch size limit (max 1000), providing useful behavioral context beyond annotations.

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 unnecessary words, earning its place.

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 presence of annotations and output schema, the description adequately covers the tool's purpose and constraint, though it could mention that it returns multiple authors.

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 input schema already includes descriptions for parameters (e.g., author_ids 'List of author IDs (max 1000)'), so the description adds no new parameter meaning beyond what is in the schema.

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 action 'Retrieve multiple authors' and specifies the resource and constraint 'max 1000', distinguishing it from single-author retrieval sibling tools.

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 implies use for batch retrieval, and the sibling 'semantic_scholar_get_author' provides contrast, but no explicit when-to-use or when-not-to-use guidance is given.

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/smaniches/semantic-scholar-mcp'

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