Skip to main content
Glama

search_arxiv

Search academic papers from arXiv using keywords to find relevant research articles and access paper content for academic purposes.

Instructions

搜索 arXiv 论文

Input Schema

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

Implementation Reference

  • Core handler function that performs the arXiv paper search using ArXivClient and processes the results into a structured format.
    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)}`);
      }
    }
  • MCP CallToolRequestSchema dispatch case for 'search_arxiv' that invokes the core search function and formats the tool response.
    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')}`
        }]
      };
    }
  • src/index.ts:324-341 (registration)
    Tool registration definition returned by ListToolsRequestSchema handler, specifying name, description, and input schema for 'search_arxiv'.
    {
      name: "search_arxiv",
      description: "搜索 arXiv 论文",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "搜索英文关键词"
          },
          maxResults: {
            type: "number",
            description: "最大结果数量",
            default: 5
          }
        },
        required: ["query"]
      }
  • Input schema definition 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"]
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It only states the basic action ('搜索' - search) without mentioning any behavioral traits like whether it returns metadata only, supports pagination, has rate limits, requires authentication, or what format results come in. This leaves significant gaps 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise ('搜索 arXiv 论文' - Search arXiv papers) - just four characters in Chinese. While this is efficient and front-loaded, it might be overly terse given the tool's functionality and lack of sibling differentiation. Every word earns its place, but more content could be justified.

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 no annotations, no output schema, and the description is minimal, it's incomplete for a search tool with 2 parameters. The description doesn't explain what kind of search it performs, what fields are searched, what the results look like, or any limitations. With richer context needed, this falls short of being complete enough.

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 both parameters ('query' and 'maxResults') with descriptions. The tool description adds no additional meaning about parameters beyond what's in the schema. According to guidelines, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 purpose with a clear verb ('搜索' - search) and resource ('arXiv 论文' - arXiv papers). However, it lacks specificity about what kind of search it performs (e.g., title/abstract/full-text) and doesn't distinguish it from sibling tools like 'get_recent_ai_papers' or 'parse_paper_content'.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this search tool is appropriate compared to 'get_recent_ai_papers' (which might fetch recent papers without a query) or 'parse_paper_content' (which processes paper content). No context about use cases or exclusions is provided.

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/BACH-AI-Tools/bach-Arxiv-Paper-MCP'

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