list_github_repos
Discover and sort GitHub repositories containing Onyx code by stars or name to streamline your search for Onyx projects.
Instructions
List all discovered GitHub repositories with Onyx code
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sortBy | No | Sort repositories by | stars |
Implementation Reference
- src/core/mcp-shared.js:227-260 (handler)Main handler function that reads GitHub repositories from data file, sorts them by stars or name, formats and returns the list with total count.async listGitHubRepos(sortBy = 'stars') { try { const reposPath = path.join(this.dataDir, 'github', 'repositories.json'); let repos = JSON.parse(await fs.readFile(reposPath, 'utf8')); // Sort repositories switch (sortBy) { case 'stars': repos.sort((a, b) => b.stars - a.stars); break; case 'name': repos.sort((a, b) => a.name.localeCompare(b.name)); break; } const toolMessage = `Listing available GitHub repositories with Onyx code, sorted by ${sortBy}`; return this.formatResponse(JSON.stringify({ totalRepos: repos.length, sortedBy: sortBy, repositories: repos.map(repo => ({ name: repo.fullName, description: repo.description, stars: repo.stars, url: repo.url })) }, null, 2), toolMessage); } catch (error) { const toolMessage = 'Unable to list GitHub repositories - data may not be available yet'; return this.formatResponse( `Repository list not available. Data may need to be populated first. Error: ${error.message}`, toolMessage ); } }
- src/core/mcp-shared.js:89-98 (schema)Tool schema definition including input schema with sortBy parameter.{ name: 'list_github_repos', description: 'List all discovered GitHub repositories with Onyx code', inputSchema: { type: 'object', properties: { sortBy: { type: 'string', enum: ['stars', 'name'], description: 'Sort repositories by', default: 'stars' } } } },
- src/core/mcp-shared.js:637-638 (registration)Registration of the tool handler in the executeTool dispatcher switch statement.case 'list_github_repos': return await this.listGitHubRepos(args.sortBy);
- src/mcp-http.js:140-144 (registration)HTTP endpoint registration using TOOL_DEFINITIONS, with special GET method for this tool.TOOL_DEFINITIONS.forEach(tool => { // Special handling for list_github_repos which uses GET const method = tool.name === 'list_github_repos' ? 'GET' : 'POST'; createToolEndpoint(tool.name, method); });
- src/bridge.js:149-153 (registration)Special HTTP method handling (GET) for the tool in MCP-to-HTTP bridge.getHttpMethod(toolName) { // Most tools use POST, except list operations const getMethods = ['list_github_repos']; return getMethods.includes(toolName) ? 'GET' : 'POST'; }