Skip to main content
Glama

get_user_package

Retrieve a user's package from GitHub by specifying username, package type (npm, maven, docker, etc.), and package name to access package information.

Instructions

Get a package for a user

Input Schema

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

Implementation Reference

  • Core handler function that performs the GitHub API request to fetch a specific package for a user and validates the response using PackageSchema.
    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 schemas for the get_user_package tool: public schema and internal extended schema including github_pat.
    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"), }); export const _GetUserPackageSchema = GetUserPackageSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
  • Output schema used by the handler to parse 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(), });
  • src/index.ts:296-299 (registration)
    Tool registration in the listTools response, defining name, description, and input schema.
    name: "get_user_package", description: "Get a package for a user", inputSchema: zodToJsonSchema(packages.GetUserPackageSchema), },
  • src/index.ts:767-774 (registration)
    Dispatch handler in the switch statement that parses arguments and calls 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) }], }; }

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