Skip to main content
Glama

get_user_package

Retrieve a specific package for a user by providing the username, package type (e.g., npm, maven), and package name. Ideal for accessing user-specific package details on the MCP server.

Instructions

Get a package for a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_nameYesThe name of the package
package_typeYesThe type of package
usernameYesUsername

Implementation Reference

  • The core handler function that executes the tool logic by making a GitHub API request to retrieve a specific user package and parsing the response.
    export async function getUserPackage( github_pat: string, username: 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/users/${username}/packages/${package_type}/${package_name}` ); return PackageSchema.parse(response); }
  • Input schema (GetUserPackageSchema) used for validating tool arguments and referenced in tool registration.
    export const GetUserPackageSchema = z.object({ username: z.string().describe("Username"), 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"), });
  • src/index.ts:296-299 (registration)
    Tool registration entry in the listTools handler, defining the tool name, description, and input schema.
    name: "get_user_package", description: "Get a package for a user", inputSchema: zodToJsonSchema(packages.GetUserPackageSchema), },
  • Dispatch handler in the main CallToolRequest switch case that validates arguments with _GetUserPackageSchema and invokes the getUserPackage function.
    case "get_user_package": { const args = packages._GetUserPackageSchema.parse(params.arguments); const { github_pat, username, package_type, package_name } = args; const result = await packages.getUserPackage(github_pat, username, package_type, package_name); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
  • Output schema (PackageSchema) used to parse the GitHub API response in the handler.
    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(), });

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