Skip to main content
Glama
elias-michaias

Onyx Documentation MCP Server

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
NameRequiredDescriptionDefault
sortByNoSort repositories bystars

Implementation Reference

  • 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 ); } }
  • 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' } } } },
  • 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);
  • 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); });

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/elias-michaias/onyx_mcp'

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