Skip to main content
Glama

get-repo-info

Retrieve detailed information about a specific GitHub repository, including owner and repository name, to access repository data through the GitHub API.

Instructions

Get information about a specific GitHub repository

Input Schema

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

Implementation Reference

  • The core handler function `getRepoInfo` that executes the tool logic by fetching GitHub repository details using Octokit and returning formatted JSON.
    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, specifying required parameters owner and repo.
    "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:322-327 (registration)
    Registration of the getRepoInfo handler function under the 'get-repo-info' key in the toolHandlers export, used by the MCP server for dispatching tool calls.
    export const toolHandlers = { "search-repos": searchRepos, "get-repo-info": getRepoInfo, "list-issues": listIssues, "create-issue": createIssue, };
  • TypeScript type definition for the input arguments of the get-repo-info tool handler.
    type GetRepoInfoArgs = { owner: string; repo: string; };
  • src/handlers.ts:22-31 (registration)
    MCP server request handler for CallToolRequestSchema that dispatches to the specific tool handler based on name, enabling execution of get-repo-info.
    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); })

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