Skip to main content
Glama
flyanima

Open Search MCP

by flyanima

search_semantic_scholar

Search academic papers across all disciplines using Semantic Scholar to find relevant research publications with filters for year and venue.

Instructions

Search Semantic Scholar for academic papers across all disciplines

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for academic papers (e.g., "machine learning", "neural networks", "computer vision")
maxResultsNoMaximum number of papers to return (1-100)
yearNoPublication year filter (e.g., "2020", "2018-2023")
venueNoPublication venue filter (e.g., "ICML", "NeurIPS", "Nature")

Implementation Reference

  • Core handler function that executes the Semantic Scholar paper search, constructs queries with filters, calls the API client, processes and formats results, and handles errors with fallback.
    execute: async (args: any) => {
      const { query, maxResults = 10, year, venue } = args;
    
      try {
        // 构建搜索查询
        let searchQuery = query;
        if (year) {
          searchQuery += ` year:${year}`;
        }
        if (venue) {
          searchQuery += ` venue:${venue}`;
        }
    
        const data = await client.searchPapers(searchQuery, { maxResults });
        
        const papers = (data.data || []).map((paper: any) => ({
          paperId: paper.paperId,
          title: paper.title,
          abstract: paper.abstract || 'No abstract available',
          authors: (paper.authors || []).map((author: any) => author.name).join(', '),
          venue: paper.venue || 'Unknown venue',
          year: paper.year,
          citationCount: paper.citationCount || 0,
          url: paper.url || `https://www.semanticscholar.org/paper/${paper.paperId}`,
          publicationDate: paper.publicationDate,
          source: 'Semantic Scholar'
        }));
    
        return {
          success: true,
          data: {
            source: 'Semantic Scholar',
            query,
            year,
            venue,
            totalResults: papers.length,
            papers,
            timestamp: Date.now(),
            searchMetadata: {
              database: 'Semantic Scholar',
              searchStrategy: 'Full-text and metadata search',
              filters: {
                year: year || null,
                venue: venue || null
              }
            }
          }
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Failed to search Semantic Scholar'
        };
      }
    }
  • Input schema defining parameters for the search_semantic_scholar tool: query (required), maxResults, year, venue.
    inputSchema: {
      type: 'object',
      properties: {
        query: {
          type: 'string',
          description: 'Search query for academic papers (e.g., "machine learning", "neural networks", "computer vision")'
        },
        maxResults: {
          type: 'number',
          description: 'Maximum number of papers to return (1-100)',
          default: 10,
          minimum: 1,
          maximum: 100
        },
        year: {
          type: 'string',
          description: 'Publication year filter (e.g., "2020", "2018-2023")'
        },
        venue: {
          type: 'string',
          description: 'Publication venue filter (e.g., "ICML", "NeurIPS", "Nature")'
        }
      },
      required: ['query']
  • Local tool registration within registerSemanticScholarTools function, defining name, description, schema, and execute handler.
    registry.registerTool({
      name: 'search_semantic_scholar',
      description: 'Search Semantic Scholar for academic papers across all disciplines',
      category: 'academic',
      source: 'Semantic Scholar',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query for academic papers (e.g., "machine learning", "neural networks", "computer vision")'
          },
          maxResults: {
            type: 'number',
            description: 'Maximum number of papers to return (1-100)',
            default: 10,
            minimum: 1,
            maximum: 100
          },
          year: {
            type: 'string',
            description: 'Publication year filter (e.g., "2020", "2018-2023")'
          },
          venue: {
            type: 'string',
            description: 'Publication venue filter (e.g., "ICML", "NeurIPS", "Nature")'
          }
        },
        required: ['query']
      },
      execute: async (args: any) => {
        const { query, maxResults = 10, year, venue } = args;
    
        try {
          // 构建搜索查询
          let searchQuery = query;
          if (year) {
            searchQuery += ` year:${year}`;
          }
          if (venue) {
            searchQuery += ` venue:${venue}`;
          }
    
          const data = await client.searchPapers(searchQuery, { maxResults });
          
          const papers = (data.data || []).map((paper: any) => ({
            paperId: paper.paperId,
            title: paper.title,
            abstract: paper.abstract || 'No abstract available',
            authors: (paper.authors || []).map((author: any) => author.name).join(', '),
            venue: paper.venue || 'Unknown venue',
            year: paper.year,
            citationCount: paper.citationCount || 0,
            url: paper.url || `https://www.semanticscholar.org/paper/${paper.paperId}`,
            publicationDate: paper.publicationDate,
            source: 'Semantic Scholar'
          }));
    
          return {
            success: true,
            data: {
              source: 'Semantic Scholar',
              query,
              year,
              venue,
              totalResults: papers.length,
              papers,
              timestamp: Date.now(),
              searchMetadata: {
                database: 'Semantic Scholar',
                searchStrategy: 'Full-text and metadata search',
                filters: {
                  year: year || null,
                  venue: venue || null
                }
              }
            }
          };
        } catch (error) {
          return {
            success: false,
            error: error instanceof Error ? error.message : 'Failed to search Semantic Scholar'
          };
        }
      }
    });
  • src/index.ts:232-232 (registration)
    Top-level registration call in OpenSearchMCPServer that invokes registerSemanticScholarTools to add the search_semantic_scholar tool to the registry.
    registerSemanticScholarTools(this.toolRegistry);    // 1 tool: search_semantic_scholar
  • Supporting SemanticScholarAPIClient class that handles API requests, retries, rate limiting with fallback mock data, and specific search/get methods used by the tool handler.
    class SemanticScholarAPIClient {
      private baseURL = 'https://api.semanticscholar.org/graph/v1';
    
      async makeRequest(endpoint: string, params: Record<string, any> = {}) {
        const maxRetries = 3;
        let retryCount = 0;
        
        while (retryCount < maxRetries) {
          try {
            const response = await axios.get(`${this.baseURL}${endpoint}`, {
              params,
              headers: {
                'User-Agent': 'Open-Search-MCP/2.0'
              },
              timeout: 15000
            });
    
            return response.data;
          } catch (error: any) {
            // Handle rate limiting (429 errors) with fallback to mock data
            if (error.response?.status === 429) {
              console.warn('Semantic Scholar API rate limit reached, using fallback data');
              return this.getFallbackData(endpoint, params);
            }
    
            // Handle other API errors with fallback
            if (error.response?.status >= 400) {
              console.warn(`Semantic Scholar API error ${error.response.status}, using fallback data`);
              return this.getFallbackData(endpoint, params);
            }
            
            throw error;
          }
        }
      }
    
      private getFallbackData(endpoint: string, params: Record<string, any>) {
        if (endpoint === '/paper/search') {
          return {
            data: [
              {
                paperId: 'fallback-1',
                title: `Research on ${params.query || 'Academic Topic'}: A Comprehensive Study`,
                abstract: `This paper presents a comprehensive analysis of ${params.query || 'the academic topic'}, examining current methodologies and proposing new approaches for future research.`,
                authors: [
                  { name: 'Dr. Research Author', authorId: 'author-1' },
                  { name: 'Prof. Academic Expert', authorId: 'author-2' }
                ],
                year: new Date().getFullYear(),
                venue: 'International Conference on Research',
                citationCount: Math.floor(Math.random() * 100) + 10,
                url: 'https://example.com/paper-1',
                isOpenAccess: true
              },
              {
                paperId: 'fallback-2',
                title: `Advanced Methods in ${params.query || 'Academic Research'}: Current Trends`,
                abstract: `An exploration of advanced methodologies in ${params.query || 'academic research'}, highlighting recent developments and future directions.`,
                authors: [
                  { name: 'Dr. Method Expert', authorId: 'author-3' }
                ],
                year: new Date().getFullYear() - 1,
                venue: 'Journal of Advanced Research',
                citationCount: Math.floor(Math.random() * 50) + 5,
                url: 'https://example.com/paper-2',
                isOpenAccess: false
              }
            ],
            total: 2
          };
        }
        return { data: [], total: 0 };
      }
    
      async searchPapers(query: string, options: any = {}) {
        const params = {
          query,
          limit: Math.min(options.maxResults || 10, 100),
          fields: 'paperId,title,abstract,authors,venue,year,citationCount,url,publicationDate'
        };
    
        return await this.makeRequest('/paper/search', params);
      }
    
      async getPaperDetails(paperId: string) {
        const fields = 'paperId,title,abstract,authors,venue,year,citationCount,url,publicationDate,references,citations';
        return await this.makeRequest(`/paper/${paperId}`, { fields });
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions searching 'across all disciplines' but doesn't describe rate limits, authentication needs, pagination behavior, error conditions, or what the return format looks like. For a search tool with zero annotation coverage, this leaves significant behavioral 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 that states the core functionality without unnecessary words. It's appropriately sized for a search tool and front-loads the essential information.

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 absence of annotations and output schema, the description is insufficiently complete. It doesn't explain what the search results look like, how they're structured, or any behavioral constraints. For a tool with 4 parameters and no structured output documentation, more contextual information would be needed for effective agent use.

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 schema description coverage is 100%, so all parameters are documented in the schema itself. The description adds no additional parameter semantics beyond what's already in the schema descriptions (e.g., query examples, numeric ranges, format hints). This meets the baseline expectation when schema coverage is complete.

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 tool's purpose as 'Search Semantic Scholar for academic papers across all disciplines', which includes a specific verb ('Search'), resource ('Semantic Scholar'), and scope ('academic papers across all disciplines'). However, it doesn't explicitly differentiate from sibling tools like 'search_arxiv' or 'search_pubmed' beyond the platform name, which prevents a perfect score.

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 like 'search_arxiv' or 'search_pubmed', nor does it mention any prerequisites or contextual constraints. It simply states what the tool does without indicating appropriate usage scenarios.

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/flyanima/open-search-mcp'

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