get_release_asset
Retrieve release assets from GitHub repositories by specifying owner, repository name, and asset ID to access downloadable files.
Instructions
Get a release asset from a GitHub repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| repo | Yes | Repository name | |
| asset_id | Yes | The ID of the asset |
Implementation Reference
- src/operations/releases.ts:175-186 (handler)The primary handler function that performs the GitHub API request to fetch the release asset metadata and parses the response using ReleaseAssetSchema.export async function getReleaseAsset( github_pat: string, owner: string, repo: string, asset_id: number ): Promise<z.infer<typeof ReleaseAssetSchema>> { const response = await githubRequest( github_pat, `https://api.github.com/repos/${owner}/${repo}/releases/assets/${asset_id}` ); return ReleaseAssetSchema.parse(response); }
- src/operations/releases.ts:92-100 (schema)Input Zod schemas for validating tool parameters: public schema (GetReleaseAssetSchema) and internal schema including GitHub PAT (_GetReleaseAssetSchema).export const GetReleaseAssetSchema = z.object({ owner: z.string().describe("Repository owner (username or organization)"), repo: z.string().describe("Repository name"), asset_id: z.number().describe("The ID of the asset") }); export const _GetReleaseAssetSchema = GetReleaseAssetSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
- src/operations/releases.ts:6-20 (schema)Output Zod schema for parsing the GitHub release asset response.export const ReleaseAssetSchema = z.object({ url: z.string(), id: z.number(), node_id: z.string(), name: z.string(), label: z.string().nullable(), content_type: z.string(), state: z.string(), size: z.number(), download_count: z.number(), created_at: z.string(), updated_at: z.string(), browser_download_url: z.string(), uploader: GitHubIssueAssigneeSchema.nullable(), });
- src/index.ts:180-183 (registration)Registers the 'get_release_asset' tool in the MCP server's list of tools, including name, description, and input schema.name: "get_release_asset", description: "Get a release asset from a GitHub repository", inputSchema: zodToJsonSchema(releases.GetReleaseAssetSchema), },
- src/index.ts:559-565 (handler)MCP server dispatcher for the tool: parses arguments using internal schema and calls the core handler function.case "get_release_asset": { const args = releases._GetReleaseAssetSchema.parse(params.arguments); const result = await releases.getReleaseAsset(args.github_pat, args.owner, args.repo, args.asset_id); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }