Skip to main content
Glama
yzfly

ArXiv Paper MCP

by yzfly

search_arxiv

Search for research papers on arXiv using keywords to find scientific literature and access PDFs through the Model Context Protocol.

Instructions

搜索 arXiv 论文

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes搜索英文关键词
maxResultsNo最大结果数量

Implementation Reference

  • The core handler function for the 'search_arxiv' tool. It uses ArXivClient to search for papers based on a query and returns formatted results including title, summary, authors, etc.
    async function searchArxivPapers(query: string, maxResults: number = 5): Promise<{totalResults: number, papers: any[]}> {
      try {
        const results = await arxivClient.search({
          start: 0,
          searchQuery: {
            include: [
              { field: "all", value: query }
            ]
          },
          maxResults: maxResults
        });
    
        const papers = results.entries.map(entry => {
          const urlParts = entry.url.split('/');
          const arxivId = urlParts[urlParts.length - 1];
    
          return {
            id: arxivId,
            url: entry.url,
            title: entry.title.replace(/\s+/g, ' ').trim(),
            summary: entry.summary.replace(/\s+/g, ' ').trim(),
            published: entry.published,
            authors: entry.authors || []
          };
        });
    
        return {
          totalResults: results.totalResults,
          papers: papers
        };
      } catch (error) {
        console.error("搜索 arXiv 论文时出错:", error);
        throw new Error(`搜索失败: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Input schema for the 'search_arxiv' tool, defining parameters query (required string) and maxResults (optional number, default 5).
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "搜索英文关键词"
        },
        maxResults: {
          type: "number",
          description: "最大结果数量",
          default: 5
        }
      },
      required: ["query"]
    }
  • src/index.ts:324-342 (registration)
    Registration of the 'search_arxiv' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: "search_arxiv",
      description: "搜索 arXiv 论文",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "搜索英文关键词"
          },
          maxResults: {
            type: "number",
            description: "最大结果数量",
            default: 5
          }
        },
        required: ["query"]
      }
    },
  • Execution handler in the CallToolRequestSchema switch statement that calls searchArxivPapers and formats the response for MCP.
    case "search_arxiv": {
      const { query, maxResults = 5 } = args as { query: string; maxResults?: number };
      const results = await searchArxivPapers(query, maxResults);
    
      return {
        content: [{
          type: "text",
          text: `找到 ${results.papers.length} 篇相关论文(总计 ${results.totalResults} 篇):\n\n${results.papers.map((paper, index) =>
            `${index + 1}. **${paper.title}**\n   ID: ${paper.id}\n   发布日期: ${paper.published}\n   作者: ${paper.authors.map((author: any) => author.name || author).join(', ')}\n   摘要: ${paper.summary.substring(0, 300)}...\n   URL: ${paper.url}\n`
          ).join('\n')}`
        }]
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action without disclosing behavioral traits. It doesn't mention rate limits, authentication needs, response format, pagination, or whether it's read-only (implied but not explicit). This is a significant gap for a search tool with no structured safety hints.

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 a single, efficient sentence in Chinese ('搜索 arXiv 论文'), which is appropriately concise and front-loaded. However, it could be more structured by including key details upfront, but it earns high marks for zero waste in 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 no annotations and no output schema, the description is incomplete for a search tool. It doesn't explain return values (e.g., paper metadata, abstracts), error handling, or how results are sorted/filtered. With 2 parameters and 100% schema coverage, it minimally covers inputs but lacks context on behavior and outputs.

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 input schema fully documents parameters ('query' for English keywords, 'maxResults' with default 5). The description adds no additional meaning beyond what the schema provides, such as query syntax examples or result ordering. Baseline 3 is appropriate as the schema does the heavy lifting.

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 '搜索 arXiv 论文' (Search arXiv papers) states the basic action and resource, but it's vague about scope and doesn't distinguish from sibling tools like 'get_recent_ai_papers' or 'parse_paper_content'. It lacks specificity about what kind of search it performs (e.g., full-text, metadata, date ranges).

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 'get_recent_ai_papers' for recent papers or 'parse_paper_content' for analyzing content. The description implies a general search function but doesn't specify contexts or exclusions, leaving the agent to guess based on tool names alone.

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/yzfly/Arxiv-Paper-MCP'

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