list_github_repos
Discover GitHub repositories containing Onyx code, sorted by stars or name to find relevant 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)Core handler function that reads GitHub repositories from a JSON file, sorts them by 'stars' or 'name', and returns a formatted list with total count and repository details.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 name, description, and input schema specifying the optional 'sortBy' parameter with enum values.{ 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 in the executeTool dispatcher switch statement that maps tool calls to the listGitHubRepos handler.case 'list_github_repos': return await this.listGitHubRepos(args.sortBy);
- src/mcp-http.js:140-144 (registration)Dynamic HTTP endpoint registration for all tools, with special GET method handling for list_github_repos in the HTTP server.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); });