Skip to main content
Glama

Docker Registry Operations

docker_registry

Search Docker Hub, authenticate, and manage container images with push, pull, and tagging operations for Docker registry workflows.

Instructions

Search Docker Hub, login/logout, push/pull operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesRegistry action to perform
queryNoSearch query (required for search)
imageNoImage name (required for push, pull, tag)
tagNoImage tag
newTagNoNew tag name (required for tag action)
registryNoRegistry URL (optional for login/logout)
usernameNoUsername for login
passwordNoPassword for login

Implementation Reference

  • Handler function implementing Docker registry operations: search, login, logout, push, pull, tag. Constructs docker commands based on action and parameters, executes via executeDockerCommand, and returns formatted results or errors.
    async ({ action, query, image, tag, newTag, registry, username, password }) => {
      try {
        let command: string;
        
        switch (action) {
          case "search":
            if (!query) throw new Error("Search query is required");
            command = `docker search ${query}`;
            break;
          case "login":
            command = `docker login${registry ? ` ${registry}` : ""}`;
            if (username && password) {
              command += ` -u ${username} -p ${password}`;
            }
            break;
          case "logout":
            command = `docker logout${registry ? ` ${registry}` : ""}`;
            break;
          case "push":
            if (!image) throw new Error("Image name is required for push");
            command = `docker push ${image}${tag ? `:${tag}` : ""}`;
            break;
          case "pull":
            if (!image) throw new Error("Image name is required for pull");
            command = `docker pull ${image}${tag ? `:${tag}` : ""}`;
            break;
          case "tag":
            if (!image || !newTag) throw new Error("Image name and new tag are required for tag action");
            command = `docker tag ${image}${tag ? `:${tag}` : ""} ${newTag}`;
            break;
        }
        
        const result = await executeDockerCommand(command);
        
        return {
          content: [
            {
              type: "text",
              text: `Registry ${action} completed:\n\n${result.stdout}${result.stderr ? `\nWarnings:\n${result.stderr}` : ""}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error with registry operation: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • Input schema defining parameters for docker_registry tool: action (enum), query, image, tag, newTag, registry, username, password with Zod validation and descriptions.
    "docker_registry",
    {
      title: "Docker Registry Operations",
      description: "Search Docker Hub, login/logout, push/pull operations",
      inputSchema: {
        action: z.enum(["search", "login", "logout", "push", "pull", "tag"]).describe("Registry action to perform"),
        query: z.string().optional().describe("Search query (required for search)"),
        image: z.string().optional().describe("Image name (required for push, pull, tag)"),
        tag: z.string().optional().describe("Image tag"),
        newTag: z.string().optional().describe("New tag name (required for tag action)"),
        registry: z.string().optional().describe("Registry URL (optional for login/logout)"),
        username: z.string().optional().describe("Username for login"),
        password: z.string().optional().describe("Password for login")
      }
  • src/index.ts:1658-1729 (registration)
    Registration of the 'docker_registry' tool with McpServer using server.registerTool, including title, description, inputSchema, and handler function.
    // Register Docker registry and search tool
    server.registerTool(
      "docker_registry",
      {
        title: "Docker Registry Operations",
        description: "Search Docker Hub, login/logout, push/pull operations",
        inputSchema: {
          action: z.enum(["search", "login", "logout", "push", "pull", "tag"]).describe("Registry action to perform"),
          query: z.string().optional().describe("Search query (required for search)"),
          image: z.string().optional().describe("Image name (required for push, pull, tag)"),
          tag: z.string().optional().describe("Image tag"),
          newTag: z.string().optional().describe("New tag name (required for tag action)"),
          registry: z.string().optional().describe("Registry URL (optional for login/logout)"),
          username: z.string().optional().describe("Username for login"),
          password: z.string().optional().describe("Password for login")
        }
      },
      async ({ action, query, image, tag, newTag, registry, username, password }) => {
        try {
          let command: string;
          
          switch (action) {
            case "search":
              if (!query) throw new Error("Search query is required");
              command = `docker search ${query}`;
              break;
            case "login":
              command = `docker login${registry ? ` ${registry}` : ""}`;
              if (username && password) {
                command += ` -u ${username} -p ${password}`;
              }
              break;
            case "logout":
              command = `docker logout${registry ? ` ${registry}` : ""}`;
              break;
            case "push":
              if (!image) throw new Error("Image name is required for push");
              command = `docker push ${image}${tag ? `:${tag}` : ""}`;
              break;
            case "pull":
              if (!image) throw new Error("Image name is required for pull");
              command = `docker pull ${image}${tag ? `:${tag}` : ""}`;
              break;
            case "tag":
              if (!image || !newTag) throw new Error("Image name and new tag are required for tag action");
              command = `docker tag ${image}${tag ? `:${tag}` : ""} ${newTag}`;
              break;
          }
          
          const result = await executeDockerCommand(command);
          
          return {
            content: [
              {
                type: "text",
                text: `Registry ${action} completed:\n\n${result.stdout}${result.stderr ? `\nWarnings:\n${result.stderr}` : ""}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error with registry operation: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral insight. It mentions operations like 'login/logout' and 'push/pull' but doesn't disclose authentication requirements, rate limits, side effects (e.g., data transfer), or error handling. For a multi-action tool with potential security implications, 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.

Conciseness4/5

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

The description is extremely concise (three comma-separated phrases) and front-loaded with all key operations. However, it's arguably too terse for a complex multi-action tool, missing explanatory context that could justify a higher score.

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 the tool's complexity (8 parameters, multiple actions), lack of annotations, and no output schema, the description is insufficient. It doesn't explain return values, error conditions, or behavioral nuances (e.g., what 'login' actually does), leaving significant gaps for agent understanding.

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 the schema fully documents all 8 parameters. The description adds no parameter-specific information beyond implying that 'search', 'login/logout', and 'push/pull' correspond to the 'action' enum. This meets the baseline for high schema coverage but doesn't enhance understanding.

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

Purpose3/5

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

The description lists multiple operations (search, login/logout, push/pull) but lacks specificity about what resources are involved (e.g., Docker Hub images, registry authentication). It distinguishes from siblings by focusing on registry operations rather than container/image management, but the purpose remains somewhat vague as it doesn't clearly state what the tool fundamentally does.

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?

No guidance is provided on when to use this tool versus alternatives like 'manage_images' or 'execute_docker_command'. The description merely enumerates actions without context about prerequisites, dependencies, or appropriate scenarios for each operation.

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/TauqeerAhmad5201/docker-mcp-extension'

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