Skip to main content
Glama

list_repo_packages

Retrieve and filter packages for a GitHub repository by specifying owner, repo, and package type (e.g., npm, maven). Supports pagination for large results.

Instructions

List packages for a repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
package_typeNoThe type of package to filter for
pageNoPage number of the results
per_pageNoResults per page (max 100)
repoYesRepository name

Implementation Reference

  • Main handler function that fetches and parses repository packages from GitHub API
    export async function listRepoPackages( github_pat: string, owner: string, repo: string, options: { package_type?: "npm" | "maven" | "rubygems" | "docker" | "nuget" | "container"; per_page?: number; page?: number; } = {} ): Promise<z.infer<typeof PackageSchema>[]> { const url = new URL(`https://api.github.com/repos/${owner}/${repo}/packages`); if (options.package_type) url.searchParams.append("package_type", options.package_type); 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); }
  • Zod input schemas: public ListRepoPackagesSchema used for registration, internal _ListRepoPackagesSchema with github_pat for parsing
    export const ListRepoPackagesSchema = 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"]).optional().describe("The type of package to filter for"), per_page: z.number().optional().describe("Results per page (max 100)"), page: z.number().optional().describe("Page number of the results"), }); export const _ListRepoPackagesSchema = ListRepoPackagesSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
  • src/index.ts:286-289 (registration)
    Tool registration in the MCP server's listTools response, specifying name, description, and input schema
    name: "list_repo_packages", description: "List packages for a repository", inputSchema: zodToJsonSchema(packages.ListRepoPackagesSchema), },
  • Dispatch handler in CallToolRequest that parses arguments and calls the packages.listRepoPackages function
    case "list_repo_packages": { const args = packages._ListRepoPackagesSchema.parse(params.arguments); const { github_pat, owner, repo, ...options } = args; const result = await packages.listRepoPackages(github_pat, owner, repo, options); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }

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/MissionSquad/mcp-github'

If you have feedback or need assistance with the MCP directory API, please join our Discord server