get_release_asset
Retrieve a specific asset from a GitHub release by providing the repository owner, repo name, and asset ID. Streamlines access to release artifacts for automation or integration workflows.
Instructions
Get a release asset from a GitHub repository
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asset_id | Yes | The ID of the asset | |
| owner | Yes | Repository owner (username or organization) | |
| repo | Yes | Repository name |
Implementation Reference
- src/operations/releases.ts:175-186 (handler)The core handler function that makes the GitHub API request to retrieve the release asset details and validates the response using Zod.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-96 (schema)Input schema definition for the get_release_asset tool parameters (owner, repo, asset_id).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") });
- src/operations/releases.ts:98-100 (schema)Extended input schema including the GitHub PAT, used for parsing arguments in the handler.export const _GetReleaseAssetSchema = GetReleaseAssetSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
- src/index.ts:180-183 (registration)Tool registration in the listTools response, defining 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 (registration)Dispatch handler in the callTool switch statement that parses arguments and invokes the getReleaseAsset 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) }], }; }