Skip to main content
Glama

list_user_packages

Retrieve and filter packages by type, visibility, and pagination for a specified user on the MCP GitHub server to manage and track software dependencies effectively.

Instructions

List packages for a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_typeNoThe type of package to filter for
pageNoPage number of the results
per_pageNoResults per page (max 100)
usernameYesUsername
visibilityNoThe visibility to filter for

Implementation Reference

  • Core handler function that executes the logic to list GitHub packages for a user by constructing the API URL, making the request, and parsing the response with Zod.
    export async function listUserPackages( github_pat: string, username: 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/users/${username}/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); }
  • Zod schema defining the input parameters for the list_user_packages tool, used in tool registration.
    export const ListUserPackagesSchema = z.object({ username: z.string().describe("Username"), package_type: z.enum(["npm", "maven", "rubygems", "docker", "nuget", "container"]).optional().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)"), page: z.number().optional().describe("Page number of the results"), });
  • src/index.ts:280-284 (registration)
    Tool registration in the MCP server, defining name, description, and input schema.
    { name: "list_user_packages", description: "List packages for a user", inputSchema: zodToJsonSchema(packages.ListUserPackagesSchema), },
  • Dispatch handler in the main switch case that parses arguments, calls the core handler, and formats the response.
    case "list_user_packages": { const args = packages._ListUserPackagesSchema.parse(params.arguments); const { github_pat, username, ...options } = args; const result = await packages.listUserPackages(github_pat, username, 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