Skip to main content
Glama
nahmanmate

Code Research MCP Server

by nahmanmate

search_all

Search programming resources across multiple platforms simultaneously to find code examples and documentation. Enter a query to get results from Stack Overflow, MDN, GitHub, npm, and PyPI.

Instructions

Search all platforms simultaneously

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
limitNoMaximum results per platform (1-5, default: 3)

Implementation Reference

  • Implements the core logic of the 'search_all' tool by searching multiple platforms (Stack Overflow, MDN, GitHub, npm, PyPI) concurrently, caching results, and formatting the output.
    private async searchAll(query: string, limit: number = 3): Promise<string> {
      const cacheKey = `all:${query}:${limit}`;
      const cached = cache.get<string>(cacheKey);
      if (cached) return cached;
    
      try {
        // Execute non-GitHub searches first
        const [so, mdn, npm, pypi] = await Promise.all([
          this.searchStackOverflow(query, limit).catch(error =>
            `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
          ),
          this.searchMDN(query).catch(error =>
            `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
          ),
          this.searchNpm(query, limit).catch(error =>
            `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
          ),
          this.searchPyPI(query).catch(error =>
            `Error: ${error instanceof Error ? error.message : 'Unknown error'}`
          )
        ]);
    
        let results = `=== Stack Overflow Results ===\n${so}\n\n` +
                     `=== MDN Documentation ===\n${mdn}\n\n`;
    
        // Try GitHub search separately
        try {
          const gh = await this.searchGitHub(query, undefined, limit);
          results += `=== GitHub Results ===\n${gh}\n\n`;
        } catch (error) {
          results += `=== GitHub Results ===\nGitHub search currently unavailable\n\n`;
        }
    
        results += `=== npm Packages ===\n${npm}\n\n` +
                  `=== PyPI Packages ===\n${pypi}`;
    
        cache.set(cacheKey, results);
        return results;
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Search all platforms error: ${error instanceof Error ? error.message : 'Unknown error'}`
        );
      }
    }
  • Defines the input schema for the 'search_all' tool, including required 'query' string and optional 'limit' number with constraints.
    inputSchema: {
      type: 'object',
      properties: {
        query: {
          type: 'string',
          description: 'Search query'
        },
        limit: {
          type: 'number',
          description: 'Maximum results per platform (1-5, default: 3)',
          minimum: 1,
          maximum: 5
        }
      },
      required: ['query']
    }
  • src/index.ts:412-431 (registration)
    Registers the 'search_all' tool metadata (name, description, schema) in the MCP ListTools response.
    {
      name: 'search_all',
      description: 'Search all platforms simultaneously',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query'
          },
          limit: {
            type: 'number',
            description: 'Maximum results per platform (1-5, default: 3)',
            minimum: 1,
            maximum: 5
          }
        },
        required: ['query']
      }
    }
  • src/index.ts:506-517 (registration)
    Handles incoming calls to the 'search_all' tool in the MCP CallToolRequest handler by extracting arguments and invoking the searchAll method.
    case 'search_all': {
      const { query, limit } = request.params.arguments as { query: string; limit?: number };
      const results = await this.searchAll(query, limit);
      return {
        content: [
          {
            type: 'text',
            text: results
          }
        ]
      };
    }

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/nahmanmate/code-research-mcp-server'

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