get_org_package
Retrieve package information for an organization from GitHub, specifying package type and name to access details for npm, Maven, RubyGems, Docker, NuGet, or container packages.
Instructions
Get a package for an organization
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| org | Yes | Organization name | |
| package_type | Yes | The type of package | |
| package_name | Yes | The name of the package |
Implementation Reference
- src/operations/packages.ts:163-174 (handler)Core handler function that retrieves a specific package from a GitHub organization by making an authenticated API request to the GitHub Packages endpoint and parsing the response with PackageSchema.export async function getOrgPackage( github_pat: string, org: 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/orgs/${org}/packages/${package_type}/${package_name}` ); return PackageSchema.parse(response); }
- src/operations/packages.ts:69-77 (schema)Zod input schemas for the get_org_package tool: GetOrgPackageSchema (public inputs) and _GetOrgPackageSchema (internal with GitHub PAT).export const GetOrgPackageSchema = z.object({ org: z.string().describe("Organization 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 _GetOrgPackageSchema = GetOrgPackageSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
- src/index.ts:290-294 (registration)MCP tool registration in the server's listTools response, specifying the tool name, description, and input schema.{ name: "get_org_package", description: "Get a package for an organization", inputSchema: zodToJsonSchema(packages.GetOrgPackageSchema), },
- src/index.ts:758-765 (registration)Dispatch handler in the server's CallToolRequest handler that validates arguments with _GetOrgPackageSchema and invokes the getOrgPackage function.case "get_org_package": { const args = packages._GetOrgPackageSchema.parse(params.arguments); const { github_pat, org, package_type, package_name } = args; const result = await packages.getOrgPackage(github_pat, org, package_type, package_name); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
- src/operations/packages.ts:17-30 (schema)Output schema used to parse and validate the GitHub API response for package details.export const PackageSchema = z.object({ id: z.number(), name: z.string(), package_type: z.string(), owner: GitHubIssueAssigneeSchema.optional(), version_count: z.number().optional(), visibility: z.string(), url: z.string(), created_at: z.string(), updated_at: z.string(), html_url: z.string(), versions_url: z.string().optional(), repository_url: z.string().optional(), });