search_all_sources
Search across documentation and GitHub repositories to find Onyx programming language information from multiple sources.
Instructions
Search all crawled content (docs, GitHub, URLs)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query | |
| sources | No | Sources to search in | |
| limit | No | Maximum number of results |
Implementation Reference
- src/core/mcp-shared.js:263-267 (handler)The handler function that implements the core logic for the 'search_all_sources' tool. It delegates the search to SearchEngine.searchAll and formats the response.async searchAllSources(query, sources = ['docs', 'github'], limit = 10) { const results = await this.searchEngine.searchAll(query, sources, limit); const toolMessage = `Searching across multiple sources (${sources.join(', ')}) for: "${query}"`; return this.formatResponse(JSON.stringify(results, null, 2), toolMessage); }
- src/core/mcp-shared.js:101-118 (schema)The input schema and metadata for the 'search_all_sources' tool, used for MCP tool registration and validation.{ name: 'search_all_sources', description: 'Search all crawled content (docs, GitHub, URLs)', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query' }, sources: { type: 'array', items: { type: 'string', enum: ['docs', 'github'] }, description: 'Sources to search in', default: ['docs', 'github'] }, limit: { type: 'number', description: 'Maximum number of results', default: 10 } }, required: ['query'] } },
- src/core/mcp-shared.js:641-642 (registration)Registration of the tool handler in the executeTool dispatcher switch statement.case 'search_all_sources': return await this.searchAllSources(args.query, args.sources, args.limit);
- src/core/search-engine.js:192-239 (helper)Key helper method implementing the multi-source search logic, called by the handler. Performs searches on docs and GitHub, combines, ranks, and limits results.async searchAll(query, sources = ['docs', 'github'], limit = 10) { const results = { query, sources: sources, totalResults: 0, resultsBySources: {} }; const perSourceLimit = Math.ceil(limit / sources.length); if (sources.includes('docs')) { results.resultsBySources.docs = await this.searchDocs(query, perSourceLimit); if (!results.resultsBySources.docs.error) { results.totalResults += results.resultsBySources.docs.totalFound || 0; } } if (sources.includes('github')) { // Search GitHub files directly const githubFiles = await this.loadData('githubFiles'); if (githubFiles) { const githubResults = this.searchGitHubFiles(githubFiles, query, perSourceLimit); results.resultsBySources.github = githubResults; results.totalResults += githubResults.totalFound || 0; } } // Combine and rank all results const allResults = []; Object.values(results.resultsBySources).forEach(sourceResults => { if (sourceResults.results && !sourceResults.error) { sourceResults.results.forEach(result => { allResults.push({ ...result, source: sourceResults.source }); }); } }); // Sort by score (higher is better) allResults.sort((a, b) => (b.score || 0) - (a.score || 0)); results.combinedResults = allResults.slice(0, limit); return results; }