Skip to main content
Glama

upload_release_asset

Add files like binaries or documentation to GitHub releases for distribution. Specify repository details, release ID, asset name, content type, and base64-encoded content to attach assets to releases.

Instructions

Upload an asset to a GitHub release

Input Schema

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

Implementation Reference

  • The main handler function that implements the upload_release_asset tool logic. It fetches the release upload URL, constructs the final upload URL with parameters, and performs the POST request to upload the base64-encoded asset content.
    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 schemas defining the input parameters for the upload_release_asset tool. UploadReleaseAssetSchema for public inputs, _UploadReleaseAssetSchema extends it internally 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's listTools handler, defining the tool 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)
    Dispatch/registration logic in the CallToolRequest handler's switch statement, parsing arguments and calling 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) }],
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states the action ('upload') which implies a write/mutation operation, but doesn't disclose authentication requirements, rate limits, file size constraints, or what happens on success/failure. For a mutation tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose without unnecessary words. It's front-loaded with the essential action and target, making it immediately scannable. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 7 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what happens after upload (e.g., returns asset ID?), error conditions, or integration with sibling tools like 'get_release_asset'. The agent lacks critical context for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all parameters are documented in the schema. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain format expectations for 'content' beyond base64, or relationships between parameters). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('upload') and target ('asset to a GitHub release'), making the purpose immediately understandable. It distinguishes from siblings like 'create_release' or 'get_release_asset' by focusing on asset upload specifically. However, it doesn't explicitly differentiate from tools like 'push_files' or 'create_or_update_file' which might handle similar content operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing release), nor does it compare to sibling tools like 'create_release' (which creates releases) or 'get_release_asset' (which retrieves assets). The agent must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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