Skip to main content
Glama

get-repo-info

Retrieve detailed information about a GitHub repository, including owner and repository name, using the GitHub MCP Server for efficient API interactions.

Instructions

Get information about a specific GitHub repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
repoYesRepository name

Implementation Reference

  • The main handler function for the 'get-repo-info' tool. It uses Octokit to fetch repository details and returns formatted JSON or error message.
    const getRepoInfo = async (args: GetRepoInfoArgs) => { const { owner, repo } = args; try { const response = await octokit.rest.repos.get({ owner, repo, }); return { content: [ { type: "text", text: JSON.stringify( { name: response.data.full_name, description: response.data.description, stars: response.data.stargazers_count, forks: response.data.forks_count, issues: response.data.open_issues_count, language: response.data.language, created_at: response.data.created_at, updated_at: response.data.updated_at, url: response.data.html_url, default_branch: response.data.default_branch, license: response.data.license?.name || "No license", topics: response.data.topics, }, null, 2 ), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: "text", text: `Error getting repository information: ${errorMessage}`, }, ], }; } };
  • Input schema definition for the 'get-repo-info' tool, used for tool listing and validation.
    "get-repo-info": { name: "get-repo-info", description: "Get information about a specific GitHub repository", inputSchema: { type: "object", properties: { owner: { type: "string", description: "Repository owner (username or organization)", }, repo: { type: "string", description: "Repository name", } }, required: ["owner", "repo"], }, },
  • TypeScript type definition for the arguments accepted by the getRepoInfo handler.
    type GetRepoInfoArgs = { owner: string; repo: string; };
  • src/tools.ts:322-327 (registration)
    Export of the toolHandlers object that maps tool names to their handler functions, used by the generic tool call handler.
    export const toolHandlers = { "search-repos": searchRepos, "get-repo-info": getRepoInfo, "list-issues": listIssues, "create-issue": createIssue, };
  • src/handlers.ts:22-32 (registration)
    MCP server request handler for calling tools, which dispatches based on tool name to the corresponding handler from toolHandlers.
    server.setRequestHandler(CallToolRequestSchema, async (request) => { type ToolHandlerKey = keyof typeof toolHandlers; const { name, arguments: params } = request.params ?? {}; const handler = toolHandlers[name as ToolHandlerKey]; if (!handler) throw new Error("tool not found"); type HandlerParams = Parameters<typeof handler>; return handler(params as any); }) }

Other Tools

Related Tools

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/alsonwangkhem/github-mcp-2'

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