get_repo_package
Retrieve package information from GitHub repositories by specifying owner, repository, package type, and package name.
Instructions
Get a package for a repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| repo | Yes | Repository name | |
| package_type | Yes | The type of package | |
| package_name | Yes | The name of the package |
Implementation Reference
- src/operations/packages.ts:189-201 (handler)The core handler function that makes the GitHub API request to retrieve a specific package from a repository and parses the response using the PackageSchema.export async function getRepoPackage( github_pat: string, owner: string, repo: string, package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container", package_name: string ): Promise<z.infer<typeof PackageSchema>> { const response = await githubRequest( github_pat, `https://api.github.com/repos/${owner}/${repo}/packages/${package_type}/${package_name}` ); return PackageSchema.parse(response); }
- src/operations/packages.ts:89-98 (schema)Zod schema definitions for input validation of the get_repo_package tool, including the public schema and the internal one with github_pat.export const GetRepoPackageSchema = z.object({ owner: z.string().describe("Repository owner (username or organization)"), repo: z.string().describe("Repository name"), package_type: z.enum(["npm", "maven", "rubygems", "docker", "nuget", "container"]).describe("The type of package"), package_name: z.string().describe("The name of the package"), }); export const _GetRepoPackageSchema = GetRepoPackageSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
- src/index.ts:300-304 (registration)Tool registration in the ListToolsRequest handler, defining name, description, and input schema.{ name: "get_repo_package", description: "Get a package for a repository", inputSchema: zodToJsonSchema(packages.GetRepoPackageSchema), },
- src/index.ts:776-783 (handler)Dispatch handler in the main CallToolRequestSchema that validates arguments using _GetRepoPackageSchema and calls the getRepoPackage function.case "get_repo_package": { const args = packages._GetRepoPackageSchema.parse(params.arguments); const { github_pat, owner, repo, package_type, package_name } = args; const result = await packages.getRepoPackage(github_pat, owner, repo, package_type, package_name); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }