Skip to main content
Glama

ghcr_push

Tag and push Docker images to GitHub Container Registry for container deployment in DevOps workflows.

Instructions

Tag and push image to GitHub Container Registry

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler logic for ghcr_push tool: constructs GHCR image tag from inputs, tags local Docker image, pushes to GHCR using docker CLI, handles tagging and push errors with helpful messages, returns formatted success response with image details and usage instructions.
        const ghcrTag = `ghcr.io/${github_owner.toLowerCase()}/${repo_name.toLowerCase()}:${tag}`;
    
        // Tag the image
        const tagResult = await runCommand(`docker tag ${local_image} ${ghcrTag}`);
        if (!tagResult.success) {
          return {
            content: [{
              type: "text",
              text: `Failed to tag image!\n\nError: ${tagResult.error}\n\nMake sure the local image exists:\n  docker images | grep ${local_image.split(":")[0]}`
            }]
          };
        }
    
        // Push the image
        const pushResult = await runCommand(`docker push ${ghcrTag}`, { timeout: 300000 });
        if (!pushResult.success) {
          let help = "";
          if (pushResult.stderr?.includes("denied") || pushResult.stderr?.includes("unauthorized")) {
            help = "\n\nAuthentication failed! Run 'ghcr_login_guide' for help.";
          }
          return {
            content: [{
              type: "text",
              text: `Failed to push!\n\nError: ${pushResult.stderr || pushResult.error}${help}`
            }]
          };
        }
    
        return {
          content: [{
            type: "text",
            text: `Successfully pushed to GHCR!
    
    Image: ${ghcrTag}
    
    View at: https://github.com/${github_owner}?tab=packages
    
    To pull this image:
      docker pull ${ghcrTag}
    
    To use in Kubernetes/Docker Compose:
      image: ${ghcrTag}`
          }]
        };
      }
    );
  • Input schema/validation for ghcr_push tool parameters.
      local_image: { type: "string", description: "Local image name:tag" },
      github_owner: { type: "string", description: "GitHub username or org" },
      repo_name: { type: "string", description: "Repository/image name" },
      tag: { type: "string", description: "Tag for GHCR", default: "latest" }
    },
    async ({ local_image, github_owner, repo_name, tag }) => {
  • src/index.js:505-560 (registration)
    MCP server registration of the ghcr_push tool with name, description, schema, and handler reference.
      "ghcr_push",
      "Tag and push image to GitHub Container Registry",
      {
        local_image: { type: "string", description: "Local image name:tag" },
        github_owner: { type: "string", description: "GitHub username or org" },
        repo_name: { type: "string", description: "Repository/image name" },
        tag: { type: "string", description: "Tag for GHCR", default: "latest" }
      },
      async ({ local_image, github_owner, repo_name, tag }) => {
        const ghcrTag = `ghcr.io/${github_owner.toLowerCase()}/${repo_name.toLowerCase()}:${tag}`;
    
        // Tag the image
        const tagResult = await runCommand(`docker tag ${local_image} ${ghcrTag}`);
        if (!tagResult.success) {
          return {
            content: [{
              type: "text",
              text: `Failed to tag image!\n\nError: ${tagResult.error}\n\nMake sure the local image exists:\n  docker images | grep ${local_image.split(":")[0]}`
            }]
          };
        }
    
        // Push the image
        const pushResult = await runCommand(`docker push ${ghcrTag}`, { timeout: 300000 });
        if (!pushResult.success) {
          let help = "";
          if (pushResult.stderr?.includes("denied") || pushResult.stderr?.includes("unauthorized")) {
            help = "\n\nAuthentication failed! Run 'ghcr_login_guide' for help.";
          }
          return {
            content: [{
              type: "text",
              text: `Failed to push!\n\nError: ${pushResult.stderr || pushResult.error}${help}`
            }]
          };
        }
    
        return {
          content: [{
            type: "text",
            text: `Successfully pushed to GHCR!
    
    Image: ${ghcrTag}
    
    View at: https://github.com/${github_owner}?tab=packages
    
    To pull this image:
      docker pull ${ghcrTag}
    
    To use in Kubernetes/Docker Compose:
      image: ${ghcrTag}`
          }]
        };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'Tag and push' which implies a write/mutation operation, but doesn't specify authentication requirements, rate limits, side effects, or what happens if the image already exists. This leaves significant gaps for a tool that likely modifies registry state.

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 appropriately sized and front-loaded with the essential information, making every word earn 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?

Given that this is likely a mutation tool (pushing images) with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after pushing, error conditions, authentication needs, or how it relates to sibling tools like 'ghcr_login_guide'. The description should provide more 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.

Parameters4/5

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

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the input requirements. The description doesn't need to add parameter information, and it appropriately doesn't mention any parameters. A baseline of 4 is appropriate for zero-parameter tools.

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 ('Tag and push') and target resource ('image to GitHub Container Registry'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'docker_build' or 'azure_container_apps_deploy' that might involve similar container operations, so it doesn't reach the highest clarity level.

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 authentication via 'ghcr_login_guide'), exclusions, or contextual factors that would help an agent choose between this and sibling tools like 'docker_build' or 'azure_container_apps_deploy'.

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/rideRTD/RTD-DevOps'

If you have feedback or need assistance with the MCP directory API, please join our Discord server