list_org_packages
Retrieve and filter packages for a GitHub organization by type and visibility to manage dependencies and track software assets.
Instructions
List packages for an organization
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| org | Yes | Organization name | |
| package_type | Yes | The type of package to filter for | |
| visibility | No | The visibility to filter for | |
| per_page | No | Results per page (max 100, default 30) | |
| page | No | Page number of the results |
Implementation Reference
- src/operations/packages.ts:101-120 (handler)Core handler function that constructs the GitHub API URL for organization packages, appends query parameters, fetches data using githubRequest, and parses the response with Zod.
export async function listOrgPackages( github_pat: string, org: string, options: { package_type: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container"; visibility?: "public" | "private" | "internal"; per_page?: number; page?: number; } = { package_type: "npm" } ): Promise<z.infer<typeof PackageSchema>[]> { const url = new URL(`https://api.github.com/orgs/${org}/packages`); if (options.package_type) url.searchParams.append("package_type", options.package_type); if (options.visibility) url.searchParams.append("visibility", options.visibility); if (options.per_page) url.searchParams.append("per_page", options.per_page.toString()); if (options.page) url.searchParams.append("page", options.page.toString()); const response = await githubRequest(github_pat, url.toString()); return z.array(PackageSchema).parse(response); } - src/operations/packages.ts:33-39 (schema)Public input schema for the list_org_packages tool, used in tool registration's inputSchema.
export const ListOrgPackagesSchema = z.object({ org: z.string().describe("Organization name"), package_type: z.enum(["npm", "maven", "rubygems", "docker", "nuget", "container"]).describe("The type of package to filter for"), visibility: z.enum(["public", "private", "internal"]).optional().describe("The visibility to filter for"), per_page: z.number().optional().describe("Results per page (max 100, default 30)"), page: z.number().optional().describe("Page number of the results"), }); - src/operations/packages.ts:41-43 (schema)Extended internal schema including github_pat, used for parsing arguments in the dispatch handler.
export const _ListOrgPackagesSchema = ListOrgPackagesSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), }); - src/index.ts:276-278 (registration)Tool registration entry in the ListTools response, defining name, description, and input schema.
name: "list_org_packages", description: "List packages for an organization", inputSchema: zodToJsonSchema(packages.ListOrgPackagesSchema), - src/index.ts:731-737 (handler)Dispatch handler in CallToolRequest that parses arguments with internal schema, extracts parameters, calls the core listOrgPackages function, and formats response.
case "list_org_packages": { const args = packages._ListOrgPackagesSchema.parse(params.arguments); const { github_pat, org, ...options } = args; const result = await packages.listOrgPackages(github_pat, org, options); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], };