Skip to main content
Glama

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
NameRequiredDescriptionDefault
ownerYesRepository owner (username or organization)
repoYesRepository name
asset_idYesThe ID of the asset

Implementation Reference

  • 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);
    }
  • 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"),
    });
  • 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),
    },
  • 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) }],
      };
    }

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