Skip to main content
Glama

upload_release_asset

Upload assets to GitHub releases by specifying the repository details, release ID, asset name, content, and type. Simplify file distribution and version management directly from the mcp-github MCP server.

Instructions

Upload an asset to a GitHub release

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesThe content of the asset (base64 encoded)
content_typeYesThe content type of the asset
labelNoAn alternate short description of the asset
nameYesThe name of the asset
ownerYesRepository owner (username or organization)
release_idYesThe ID of the release
repoYesRepository name

Implementation Reference

  • Main handler function that implements the upload_release_asset tool logic: fetches release upload URL, constructs the upload endpoint, decodes base64 content, and uploads the asset to GitHub.
    export async function uploadReleaseAsset( github_pat: string, owner: string, repo: string, release_id: number, name: string, content: string, content_type: string, label?: string ): Promise<z.infer<typeof ReleaseAssetSchema>> { // Get the release to get the upload_url const release = await githubRequest( github_pat, `https://api.github.com/repos/${owner}/${repo}/releases/${release_id}` ); const uploadUrl = (release as any).upload_url.replace( "{?name,label}", "" ); const url = new URL(uploadUrl); url.searchParams.append("name", name); if (label) url.searchParams.append("label", label); const response = await githubRequest( github_pat, url.toString(), { method: "POST", body: Buffer.from(content, "base64").toString(), headers: { "Content-Type": content_type, }, } ); return ReleaseAssetSchema.parse(response); }
  • Zod input schema definition for upload_release_asset tool, including public schema and internal extended schema with github_pat.
    export const UploadReleaseAssetSchema = z.object({ owner: z.string().describe("Repository owner (username or organization)"), repo: z.string().describe("Repository name"), release_id: z.number().describe("The ID of the release"), name: z.string().describe("The name of the asset"), label: z.string().optional().describe("An alternate short description of the asset"), content: z.string().describe("The content of the asset (base64 encoded)"), content_type: z.string().describe("The content type of the asset") }); export const _UploadReleaseAssetSchema = UploadReleaseAssetSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
  • src/index.ts:184-188 (registration)
    Tool registration in the MCP server listTools handler, defining name, description, and input schema.
    { name: "upload_release_asset", description: "Upload an asset to a GitHub release", inputSchema: zodToJsonSchema(releases.UploadReleaseAssetSchema), },
  • src/index.ts:567-576 (registration)
    Dispatcher/registration in the MCP server CallToolRequest handler switch statement, parses arguments and calls the uploadReleaseAsset function.
    case "upload_release_asset": { const args = releases._UploadReleaseAssetSchema.parse(params.arguments); const { github_pat, owner, repo, release_id, name, content, content_type, label } = args; const result = await releases.uploadReleaseAsset( github_pat, owner, repo, release_id, name, content, content_type, label ); 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