Skip to main content
Glama
flyanima

Open Search MCP

by flyanima

intelligent_research

Search across web, news, academic, and social sources with smart ranking, deduplication, and analysis to find comprehensive research results.

Instructions

Intelligent search across multiple sources with smart ranking and deduplication

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query to execute across multiple sources
sourcesNoSources to search: web, news, academic, social, tech
maxResultsNoMaximum results per source (1-20)
includeAnalysisNoInclude intelligent analysis of results

Implementation Reference

  • Core execution logic for intelligent_research tool. Performs parallel searches across web (Google), news (NewsAPI), academic (arXiv), social (Reddit), and tech (GitHub) sources, extracts and ranks results by relevance to query, deduplicates, adds analysis, and returns structured aggregated results with metadata.
    execute: async (args: any) => {
      try {
        const startTime = Date.now();
        const sources = args.sources || ['web', 'news', 'academic', 'social'];
        const maxResults = args.maxResults || 5;
        const results: any = {
          query: args.query,
          sources_searched: [],
          results_by_source: {},
          aggregated_results: [],
          analysis: {},
          metadata: {
            search_time: 0,
            total_results: 0,
            sources_count: 0
          }
        };
    
        // 并行搜索多个源
        const searchPromises = [];
    
        // Web搜索 (Google)
        if (sources.includes('web')) {
          const webTool = registry.getTool('google_web_search');
          if (webTool) {
            searchPromises.push(
              webTool.execute({ query: args.query, limit: maxResults })
                .then(result => ({ source: 'web', data: result }))
                .catch(error => ({ source: 'web', error: error.message }))
            );
          }
        }
    
        // 新闻搜索 (NewsAPI)
        if (sources.includes('news')) {
          const newsTool = registry.getTool('newsapi_search');
          if (newsTool) {
            searchPromises.push(
              newsTool.execute({ query: args.query, maxResults })
                .then(result => ({ source: 'news', data: result }))
                .catch(error => ({ source: 'news', error: error.message }))
            );
          }
        }
    
        // 学术搜索 (arXiv)
        if (sources.includes('academic')) {
          const academicTool = registry.getTool('search_arxiv');
          if (academicTool) {
            searchPromises.push(
              academicTool.execute({ query: args.query, max_results: maxResults })
                .then(result => ({ source: 'academic', data: result }))
                .catch(error => ({ source: 'academic', error: error.message }))
            );
          }
        }
    
        // 社交媒体搜索 (Reddit)
        if (sources.includes('social')) {
          const socialTool = registry.getTool('reddit_post_search');
          if (socialTool) {
            searchPromises.push(
              socialTool.execute({ query: args.query, maxResults })
                .then(result => ({ source: 'social', data: result }))
                .catch(error => ({ source: 'social', error: error.message }))
            );
          }
        }
    
        // 技术搜索 (GitHub)
        if (sources.includes('tech')) {
          const techTool = registry.getTool('github_repository_search');
          if (techTool) {
            searchPromises.push(
              techTool.execute({ query: args.query, maxResults })
                .then(result => ({ source: 'tech', data: result }))
                .catch(error => ({ source: 'tech', error: error.message }))
            );
          }
        }
    
        // 等待所有搜索完成
        const searchResults = await Promise.all(searchPromises);
    
        // 处理搜索结果
        let totalResults = 0;
        const allResults: any[] = [];
    
        for (const searchResult of searchResults) {
          if ('error' in searchResult) {
            results.results_by_source[searchResult.source] = {
              status: 'error',
              error: searchResult.error
            };
            continue;
          }
    
          const sourceData = searchResult.data;
          if (sourceData.success && sourceData.data) {
            const sourceResults = extractResults(sourceData.data, searchResult.source);
            results.results_by_source[searchResult.source] = {
              status: 'success',
              count: sourceResults.length,
              results: sourceResults
            };
            results.sources_searched.push(searchResult.source);
            totalResults += sourceResults.length;
            allResults.push(...sourceResults.map((r: any) => ({ ...r, source: searchResult.source })));
          } else {
            results.results_by_source[searchResult.source] = {
              status: 'no_results',
              error: sourceData.error || 'No results found'
            };
          }
        }
    
        // 智能排序和去重
        const rankedResults = rankAndDeduplicateResults(allResults, args.query);
        results.aggregated_results = rankedResults.slice(0, maxResults * 2); // 返回更多聚合结果
    
        // 生成分析
        if (args.includeAnalysis) {
          results.analysis = {
            query_analysis: `Search for "${args.query}" across ${results.sources_searched.length} sources`,
            source_performance: results.sources_searched.map((source: string) => ({
              source,
              status: results.results_by_source[source].status,
              result_count: results.results_by_source[source].count || 0
            })),
            recommendations: ['Consider searching more sources for comprehensive results']
          };
        }
    
        // 设置元数据
        results.metadata = {
          search_time: Date.now() - startTime,
          total_results: totalResults,
          sources_count: results.sources_searched.length,
          aggregated_count: results.aggregated_results.length
        };
    
        return {
          success: true,
          data: results
        };
    
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Smart search failed'
        };
      }
    }
  • Input schema defining parameters for the intelligent_research tool: query (required), sources array (default: web, news, academic, social), maxResults (1-20, default 5), includeAnalysis (default true).
    inputSchema: {
      type: 'object',
      properties: {
        query: {
          type: 'string',
          description: 'Search query to execute across multiple sources'
        },
        sources: {
          type: 'array',
          items: { type: 'string' },
          description: 'Sources to search: web, news, academic, social, tech',
          default: ['web', 'news', 'academic', 'social']
        },
        maxResults: {
          type: 'number',
          description: 'Maximum results per source (1-20)',
          default: 5,
          minimum: 1,
          maximum: 20
        },
        includeAnalysis: {
          type: 'boolean',
          description: 'Include intelligent analysis of results',
          default: true
        }
      },
      required: ['query']
    },
  • Tool registration within registerSmartSearchTools function, defining name, description, category, source, inputSchema, and execute handler for 'intelligent_research'.
    registry.registerTool({
      name: 'intelligent_research',
      description: 'Intelligent search across multiple sources with smart ranking and deduplication',
      category: 'aggregation',
      source: 'multiple',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query to execute across multiple sources'
          },
          sources: {
            type: 'array',
            items: { type: 'string' },
            description: 'Sources to search: web, news, academic, social, tech',
            default: ['web', 'news', 'academic', 'social']
          },
          maxResults: {
            type: 'number',
            description: 'Maximum results per source (1-20)',
            default: 5,
            minimum: 1,
            maximum: 20
          },
          includeAnalysis: {
            type: 'boolean',
            description: 'Include intelligent analysis of results',
            default: true
          }
        },
        required: ['query']
      },
      execute: async (args: any) => {
        try {
          const startTime = Date.now();
          const sources = args.sources || ['web', 'news', 'academic', 'social'];
          const maxResults = args.maxResults || 5;
          const results: any = {
            query: args.query,
            sources_searched: [],
            results_by_source: {},
            aggregated_results: [],
            analysis: {},
            metadata: {
              search_time: 0,
              total_results: 0,
              sources_count: 0
            }
          };
    
          // 并行搜索多个源
          const searchPromises = [];
    
          // Web搜索 (Google)
          if (sources.includes('web')) {
            const webTool = registry.getTool('google_web_search');
            if (webTool) {
              searchPromises.push(
                webTool.execute({ query: args.query, limit: maxResults })
                  .then(result => ({ source: 'web', data: result }))
                  .catch(error => ({ source: 'web', error: error.message }))
              );
            }
          }
    
          // 新闻搜索 (NewsAPI)
          if (sources.includes('news')) {
            const newsTool = registry.getTool('newsapi_search');
            if (newsTool) {
              searchPromises.push(
                newsTool.execute({ query: args.query, maxResults })
                  .then(result => ({ source: 'news', data: result }))
                  .catch(error => ({ source: 'news', error: error.message }))
              );
            }
          }
    
          // 学术搜索 (arXiv)
          if (sources.includes('academic')) {
            const academicTool = registry.getTool('search_arxiv');
            if (academicTool) {
              searchPromises.push(
                academicTool.execute({ query: args.query, max_results: maxResults })
                  .then(result => ({ source: 'academic', data: result }))
                  .catch(error => ({ source: 'academic', error: error.message }))
              );
            }
          }
    
          // 社交媒体搜索 (Reddit)
          if (sources.includes('social')) {
            const socialTool = registry.getTool('reddit_post_search');
            if (socialTool) {
              searchPromises.push(
                socialTool.execute({ query: args.query, maxResults })
                  .then(result => ({ source: 'social', data: result }))
                  .catch(error => ({ source: 'social', error: error.message }))
              );
            }
          }
    
          // 技术搜索 (GitHub)
          if (sources.includes('tech')) {
            const techTool = registry.getTool('github_repository_search');
            if (techTool) {
              searchPromises.push(
                techTool.execute({ query: args.query, maxResults })
                  .then(result => ({ source: 'tech', data: result }))
                  .catch(error => ({ source: 'tech', error: error.message }))
              );
            }
          }
    
          // 等待所有搜索完成
          const searchResults = await Promise.all(searchPromises);
    
          // 处理搜索结果
          let totalResults = 0;
          const allResults: any[] = [];
    
          for (const searchResult of searchResults) {
            if ('error' in searchResult) {
              results.results_by_source[searchResult.source] = {
                status: 'error',
                error: searchResult.error
              };
              continue;
            }
    
            const sourceData = searchResult.data;
            if (sourceData.success && sourceData.data) {
              const sourceResults = extractResults(sourceData.data, searchResult.source);
              results.results_by_source[searchResult.source] = {
                status: 'success',
                count: sourceResults.length,
                results: sourceResults
              };
              results.sources_searched.push(searchResult.source);
              totalResults += sourceResults.length;
              allResults.push(...sourceResults.map((r: any) => ({ ...r, source: searchResult.source })));
            } else {
              results.results_by_source[searchResult.source] = {
                status: 'no_results',
                error: sourceData.error || 'No results found'
              };
            }
          }
    
          // 智能排序和去重
          const rankedResults = rankAndDeduplicateResults(allResults, args.query);
          results.aggregated_results = rankedResults.slice(0, maxResults * 2); // 返回更多聚合结果
    
          // 生成分析
          if (args.includeAnalysis) {
            results.analysis = {
              query_analysis: `Search for "${args.query}" across ${results.sources_searched.length} sources`,
              source_performance: results.sources_searched.map((source: string) => ({
                source,
                status: results.results_by_source[source].status,
                result_count: results.results_by_source[source].count || 0
              })),
              recommendations: ['Consider searching more sources for comprehensive results']
            };
          }
    
          // 设置元数据
          results.metadata = {
            search_time: Date.now() - startTime,
            total_results: totalResults,
            sources_count: results.sources_searched.length,
            aggregated_count: results.aggregated_results.length
          };
    
          return {
            success: true,
            data: results
          };
    
        } catch (error) {
          return {
            success: false,
            error: error instanceof Error ? error.message : 'Smart search failed'
          };
        }
      }
    });
  • src/index.ts:254-254 (registration)
    Invocation of registerSmartSearchTools in the main server initialization, which registers the intelligent_research tool among others.
    registerSmartSearchTools(this.toolRegistry);        // 2 tools: intelligent_research, market_intelligence_aggregator
  • Helper function used by the handler to rank results by relevance score (keyword matching) and deduplicate based on title/name/url.
    function rankAndDeduplicateResults(results: any[], query: string): any[] {
      const seen = new Set();
      const unique = results.filter(result => {
        const key = result.title || result.name || result.url;
        if (seen.has(key)) return false;
        seen.add(key);
        return true;
      });
    
      return unique.sort((a, b) => {
        const aRelevance = calculateRelevance(a, query);
        const bRelevance = calculateRelevance(b, query);
        return bRelevance - aRelevance;
      });
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'intelligent search,' 'smart ranking,' and 'deduplication,' which hint at behavior, but lacks details on permissions, rate limits, output format, or error handling. For a search tool with no annotations, this is insufficient to fully inform an agent about operational traits.

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: 'Intelligent search across multiple sources with smart ranking and deduplication.' It's front-loaded with the core purpose and wastes no words, making it easy for an agent to parse quickly. Every part of the sentence adds value, earning a high score for conciseness.

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 multi-source search tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'intelligent' entails, how results are returned, or handle potential issues like source availability. For a tool with 4 parameters and rich functionality, more context is needed to guide an agent 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?

The input schema has 100% description coverage, so parameters like 'query,' 'sources,' 'maxResults,' and 'includeAnalysis' are well-documented in the schema. The description adds no additional parameter semantics beyond what the schema provides, such as explaining 'intelligent analysis' further. With high schema coverage, the baseline is 3, as the description doesn't compensate but doesn't detract either.

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: 'Intelligent search across multiple sources with smart ranking and deduplication.' It specifies the verb ('search') and resource ('multiple sources'), and adds value with 'intelligent' and 'smart ranking and deduplication.' However, it doesn't explicitly differentiate from sibling tools like 'search_arxiv' or 'search_pubmed,' which are more specific, so it's not a 5.

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 sibling tools or contexts where this multi-source search is preferred over specific searches like 'search_arxiv' or 'search_pubmed.' There's no indication of prerequisites, exclusions, or comparative advantages, leaving usage ambiguous.

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