Skip to main content
Glama
huanongfish

ArXiv MCP Server

by huanongfish

read_paper

Access and read full research paper content in markdown format using arXiv ID to retrieve stored academic papers.

Instructions

Read the full content of a stored paper in markdown format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paper_idYesThe arXiv ID of the paper to read

Implementation Reference

  • The async handler function that executes the read_paper tool: validates paper_id, checks existence via list_papers, reads markdown from storage, returns JSON-wrapped content or error.
    async def handle_read_paper(arguments: Dict[str, Any]) -> List[types.TextContent]:
        """Handle requests to read a paper's content."""
        try:
            paper_ids = list_papers()
            paper_id = arguments["paper_id"]
            # Check if paper exists
            if paper_id not in paper_ids:
                return [
                    types.TextContent(
                        type="text",
                        text=json.dumps(
                            {
                                "status": "error",
                                "message": f"Paper {paper_id} not found in storage. You may need to download it first using download_paper.",
                            }
                        ),
                    )
                ]
    
            # Get paper content
            content = Path(settings.STORAGE_PATH, f"{paper_id}.md").read_text()
    
            return [
                types.TextContent(
                    type="text",
                    text=json.dumps(
                        {
                            "status": "success",
                            "paper_id": paper_id,
                            "content": content,
                        }
                    ),
                )
            ]
    
        except Exception as e:
            return [
                types.TextContent(
                    type="text",
                    text=json.dumps(
                        {
                            "status": "error",
                            "message": f"Error reading paper: {str(e)}",
                        }
                    ),
                )
            ]
  • Tool schema definition including name, description, and inputSchema requiring paper_id.
    read_tool = types.Tool(
        name="read_paper",
        description="Read the full content of a stored paper in markdown format",
        inputSchema={
            "type": "object",
            "properties": {
                "paper_id": {
                    "type": "string",
                    "description": "The arXiv ID of the paper to read",
                }
            },
            "required": ["paper_id"],
        },
    )
  • Registers the read_paper tool (imported as read_tool) by including it in the list returned by server.list_tools().
    @server.list_tools()
    async def list_tools() -> List[types.Tool]:
        """List available arXiv research tools."""
        return [search_tool, download_tool, list_tool, read_tool]
  • The server's call_tool method dispatches to handle_read_paper when name=='read_paper'.
    @server.call_tool()
    async def call_tool(name: str, arguments: Dict[str, Any]) -> List[types.TextContent]:
        """Handle tool calls for arXiv research functionality."""
        logger.debug(f"Calling tool {name} with arguments {arguments}")
        try:
            if name == "search_papers":
                return await handle_search(arguments)
            elif name == "download_paper":
                return await handle_download(arguments)
            elif name == "list_papers":
                return await handle_list_papers(arguments)
            elif name == "read_paper":
                return await handle_read_paper(arguments)
            else:
                return [types.TextContent(type="text", text=f"Error: Unknown tool {name}")]
        except Exception as e:
            logger.error(f"Tool error: {str(e)}")
            return [types.TextContent(type="text", text=f"Error: {str(e)}")]
  • Helper function to list all stored paper IDs, used by handle_read_paper to check existence.
    def list_papers() -> list[str]:
        """List all stored paper IDs."""
        return [p.stem for p in Path(settings.STORAGE_PATH).glob("*.md")]
Behavior2/5

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

With no annotations, the description carries full burden but only states the basic operation. It does not disclose behavioral traits such as permissions needed, error handling (e.g., for invalid paper_id), rate limits, or whether it's a read-only operation (implied but not confirmed). More context is needed for a mutation-sensitive agent.

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 zero waste—front-loaded with the core action and resource, and includes the output format. Every word earns its place without redundancy.

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 no annotations and no output schema, the description is incomplete for a tool that retrieves content. It lacks details on return values (e.g., markdown structure, error responses), behavioral context, or usage relative to siblings, leaving gaps for an agent to operate effectively.

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%, with the parameter 'paper_id' fully documented as 'The arXiv ID of the paper to read'. The description adds no additional meaning beyond this, such as format examples or constraints, meeting the baseline for high schema coverage.

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 action ('read the full content') and resource ('stored paper'), specifying the output format ('in markdown format'). It distinguishes from siblings like 'download_paper' (which might retrieve files) and 'list_papers'/'search_papers' (which list or search metadata), but does not explicitly contrast them.

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 alternatives like 'download_paper' (e.g., for raw files vs. markdown content) or 'list_papers'/'search_papers' (e.g., for browsing vs. reading). The description implies usage for accessing content but lacks explicit context or exclusions.

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/huanongfish/arxiv-mcp'

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