Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

docker_pull

Pull Docker images from registries to your development environment. Download specific images or all tagged versions for container deployment.

Instructions

Pull an image or repository from a registry

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageYesImage name and tag (e.g., "nginx:latest")
allTagsNoDownload all tagged images
cwdNoWorking directory

Implementation Reference

  • The main handler function that executes the 'docker pull' command by constructing the docker pull CLI command and calling the shared executeDockerCommand helper.
    export async function dockerPull(args: z.infer<typeof dockerPullSchema>): Promise<ToolResponse> {
      const allTagsFlag = args.allTags ? '-a' : '';
      return executeDockerCommand(`docker pull ${allTagsFlag} ${args.image}`.trim(), args.cwd);
    }
  • Zod schema defining the input validation for the docker_pull tool, used in the dispatch handler.
    export const dockerPullSchema = z.object({
      image: z.string().describe('Image name and tag (e.g., "nginx:latest")'),
      allTags: z.boolean().optional().default(false).describe('Download all tagged images'),
      cwd: z.string().optional().describe('Working directory')
    });
  • src/index.ts:479-482 (registration)
    Dispatch/registration logic in the main MCP server handler that matches tool name 'docker_pull', validates args with schema, and invokes the handler function.
    if (name === 'docker_pull') {
      const validated = dockerPullSchema.parse(args);
      return await dockerPull(validated);
    }
  • Tool metadata registration in the dockerTools array, including JSON schema for MCP tool listing, exported and used in index.ts listTools handler.
    {
      name: 'docker_pull',
      description: 'Pull an image or repository from a registry',
      inputSchema: {
        type: 'object',
        properties: {
          image: { type: 'string', description: 'Image name and tag (e.g., "nginx:latest")' },
          allTags: { type: 'boolean', default: false, description: 'Download all tagged images' },
          cwd: { type: 'string', description: 'Working directory' }
        },
        required: ['image']
      }
    },
  • Shared helper function that executes docker CLI commands via child_process.exec, handles output/error formatting in MCP ToolResponse format, used by dockerPull.
    async function executeDockerCommand(command: string, cwd?: string): Promise<ToolResponse> {
      try {
        const { stdout, stderr } = await execAsync(command, {
          cwd: cwd || process.cwd(),
          shell: '/bin/bash',
          maxBuffer: 10 * 1024 * 1024, // 10MB buffer for logs
          timeout: 60000 // 60 second timeout for builds
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: true,
                command: command,
                stdout: stdout.trim(),
                stderr: stderr.trim(),
                cwd: cwd || process.cwd()
              }, null, 2)
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: false,
                command: command,
                stdout: error.stdout?.trim() || '',
                stderr: error.stderr?.trim() || error.message,
                exitCode: error.code || 1,
                cwd: cwd || process.cwd()
              }, null, 2)
            }
          ],
          isError: true
        };
      }
    }

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/ConnorBoetig-dev/mcp2'

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