Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

docker_inspect

Retrieve detailed configuration and state information for Docker containers, images, networks, and volumes to debug and analyze containerized applications.

Instructions

Return low-level information on Docker objects (containers, images, networks, volumes)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYesContainer, image, network, or volume name/ID
typeNoType of object to inspect
cwdNoWorking directory

Implementation Reference

  • Main handler function for 'docker_inspect' tool. Executes 'docker inspect' command with optional type flag using the shared executeDockerCommand helper.
    export async function dockerInspect(args: z.infer<typeof dockerInspectSchema>): Promise<ToolResponse> {
      const typeFlag = args.type ? `--type ${args.type}` : '';
      return executeDockerCommand(`docker inspect ${typeFlag} ${args.target}`.trim(), args.cwd);
    }
  • Zod schema used for input validation in the dispatch handler.
    export const dockerInspectSchema = z.object({
      target: z.string().describe('Container, image, network, or volume name/ID'),
      type: z.enum(['container', 'image', 'network', 'volume']).optional().describe('Type of object to inspect'),
      cwd: z.string().optional().describe('Working directory')
    });
  • src/index.ts:467-470 (registration)
    Dispatch logic in main server handler that routes 'docker_inspect' calls to the dockerInspect function after schema validation.
    if (name === 'docker_inspect') {
      const validated = dockerInspectSchema.parse(args);
      return await dockerInspect(validated);
    }
  • MCP tool registration definition included in dockerTools array for listTools endpoint.
    {
      name: 'docker_inspect',
      description: 'Return low-level information on Docker objects (containers, images, networks, volumes)',
      inputSchema: {
        type: 'object',
        properties: {
          target: { type: 'string', description: 'Container, image, network, or volume name/ID' },
          type: { type: 'string', enum: ['container', 'image', 'network', 'volume'], description: 'Type of object to inspect' },
          cwd: { type: 'string', description: 'Working directory' }
        },
        required: ['target']
      }
    },
  • Shared helper function that executes docker commands via child_process.exec and formats ToolResponse.
    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