Skip to main content
Glama

search_all

Search multiple programming platforms like GitHub, PyPI, and Stack Overflow simultaneously to find code examples and documentation efficiently.

Instructions

Search all platforms simultaneously

Input Schema

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

Implementation Reference

  • The core handler function for 'search_all' tool. It performs parallel searches across Stack Overflow, MDN, npm, PyPI, and sequentially GitHub, handles caching and errors, and returns a combined formatted string of results.
    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'}` ); } }
  • Input schema for the 'search_all' tool, defining required 'query' string and optional 'limit' number (1-5).
    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)
    Registration of the 'search_all' tool in the ListTools response, including name, description, and input schema.
    { 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'] } }
  • Dispatch handler in the CallToolRequest switch statement that extracts arguments and invokes the searchAll function for 'search_all' tool.
    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 } ] }; }

Other Tools

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

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