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
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| repo | Yes | Repository name |
Implementation Reference
- src/tools.ts:183-228 (handler)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}`, }, ], }; } };
- src/tools.ts:33-50 (schema)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"], }, },
- src/tools.ts:120-123 (schema)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); }) }