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
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum results per platform (1-5, default: 3) | |
| query | Yes | Search query |
Implementation Reference
- src/index.ts:271-315 (handler)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'}` ); } }
- src/index.ts:415-429 (schema)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'] } }
- src/index.ts:506-517 (handler)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 } ] }; }