Skip to main content
Glama
Dianel555

Paper Search MCP

by Dianel555

search_google_scholar

Search academic papers on Google Scholar by query, author, or publication year to find relevant research publications.

Instructions

Search Google Scholar for academic papers using web scraping

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query string
maxResultsNoMaximum number of results to return
yearLowNoEarliest publication year
yearHighNoLatest publication year
authorNoAuthor name filter

Implementation Reference

  • Core implementation of the search_google_scholar tool: the search() method in GoogleScholarSearcher class that performs web scraping on Google Scholar using axios and cheerio, parses results, handles pagination, anti-detection (random delays, user agents), extracts metadata like title, authors, year, citations, etc.
    async search(query: string, options: GoogleScholarOptions = {}): Promise<Paper[]> {
      logDebug(`Google Scholar Search: query="${query}"`);
      
      try {
        const papers: Paper[] = [];
        let start = 0;
        const resultsPerPage = 10;
        const maxResults = options.maxResults || 10;
    
        while (papers.length < maxResults) {
          // 添加随机延迟避免检测
          await this.randomDelay();
          
          const params = this.buildSearchParams(query, start, options);
          const response = await this.makeScholarRequest(params);
          
          if (response.status !== 200) {
            logDebug(`Google Scholar HTTP Error: ${response.status}`);
            break;
          }
    
          const $ = cheerio.load(response.data);
          const results = $('.gs_ri'); // 搜索结果容器
    
          if (results.length === 0) {
            logDebug('Google Scholar: No more results found');
            break;
          }
    
          logDebug(`Google Scholar: Found ${results.length} results on page`);
    
          // 解析每个结果
          results.each((index, element) => {
            if (papers.length >= maxResults) return false; // 停止遍历
            
            const paper = this.parseScholarResult($, $(element));
            if (paper) {
              papers.push(paper);
            }
          });
    
          start += resultsPerPage;
        }
    
        logDebug(`Google Scholar Results: Found ${papers.length} papers`);
        return papers;
        
      } catch (error) {
        this.handleHttpError(error, 'search');
      }
    }
  • MCP tool call handler: switch case that parses args, calls searchers.googlescholar.search(), converts results to JSON dicts, and returns formatted text response.
    case 'search_google_scholar': {
      const { query, maxResults, yearLow, yearHigh, author } = args;
      const results = await searchers.googlescholar.search(query, {
        maxResults,
        yearLow,
        yearHigh,
        author
      } as any);
    
      return jsonTextResponse(
        `Found ${results.length} Google Scholar papers.\n\n${JSON.stringify(
          results.map((paper: Paper) => PaperFactory.toDict(paper)),
          null,
          2
        )}`
      );
    }
  • Zod schema for validating input arguments to search_google_scholar tool.
    export const SearchGoogleScholarSchema = z
      .object({
        query: z.string().min(1),
        maxResults: z.number().int().min(1).max(20).optional().default(10),
        yearLow: z.number().int().optional(),
        yearHigh: z.number().int().optional(),
        author: z.string().optional()
      })
      .strip();
  • MCP tool registration: definition of the tool including name, description, and inputSchema exported in TOOLS array.
    name: 'search_google_scholar',
    description: 'Search Google Scholar for academic papers using web scraping',
    inputSchema: {
      type: 'object',
      properties: {
        query: { type: 'string', description: 'Search query string' },
        maxResults: {
          type: 'number',
          minimum: 1,
          maximum: 20,
          description: 'Maximum number of results to return'
        },
        yearLow: {
          type: 'number',
          description: 'Earliest publication year'
        },
        yearHigh: {
          type: 'number',
          description: 'Latest publication year'
        },
        author: {
          type: 'string',
          description: 'Author name filter'
        }
      },
      required: ['query']
    }
  • Instantiation of GoogleScholarSearcher as searchers.googlescholar (also aliased as scholar).
    const googleScholarSearcher = new GoogleScholarSearcher();
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 mentions 'web scraping' without detailing behavioral traits like rate limits, authentication needs, or potential risks (e.g., blocking). It lacks information on response format, error handling, or operational constraints, leaving significant gaps.

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—it directly states the tool's function and method. It's appropriately sized and front-loaded, making it easy to grasp immediately without unnecessary elaboration.

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 complexity of a search tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain return values, error cases, or how results are structured, which is critical for an agent to use the tool effectively. The 'web scraping' hint is insufficient for full context.

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 fully documents all 5 parameters. The description adds no additional meaning beyond the schema, such as query syntax examples or interactions between parameters like yearLow and yearHigh. Baseline 3 is appropriate as the schema handles parameter documentation.

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 ('search') and resource ('Google Scholar for academic papers'), making the purpose understandable. However, it doesn't differentiate from sibling tools like search_arxiv or search_pubmed, which perform similar academic searches on different platforms, so it misses full distinction.

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, such as search_arxiv for physics papers or search_pubmed for medical literature. It mentions 'web scraping' but doesn't explain implications or exclusions, leaving usage context vague.

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/Dianel555/paper-search-mcp-nodejs'

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