Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

docker_ps

List Docker containers and their current status to monitor running applications and manage container lifecycle in development environments.

Instructions

List Docker containers with their status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allNoShow all containers (default shows just running)
filterNoFilter output based on conditions (e.g., "status=running")
formatNoOutput formattable
cwdNoWorking directory

Implementation Reference

  • Main handler function for 'docker_ps' tool. Constructs the docker ps command with flags for all, filter, format, and executes it via executeDockerCommand helper.
    export async function dockerPs(args: z.infer<typeof dockerPsSchema>): Promise<ToolResponse> {
      const allFlag = args.all ? '-a' : '';
      const filterFlag = args.filter ? `--filter "${args.filter}"` : '';
      const formatFlag = args.format === 'json'
        ? '--format "{{json .}}"'
        : '--format "table {{.ID}}\\t{{.Image}}\\t{{.Status}}\\t{{.Names}}\\t{{.Ports}}"';
    
      return executeDockerCommand(`docker ps ${allFlag} ${filterFlag} ${formatFlag}`.trim(), args.cwd);
    }
  • Zod schema defining input validation for docker_ps tool parameters: all, filter, format, cwd.
    export const dockerPsSchema = z.object({
      all: z.boolean().optional().default(false).describe('Show all containers (default shows just running)'),
      filter: z.string().optional().describe('Filter output based on conditions (e.g., "status=running")'),
      format: z.enum(['table', 'json']).optional().default('table').describe('Output format'),
      cwd: z.string().optional().describe('Working directory')
    });
  • Tool registration entry in dockerTools array, providing MCP-compatible tool metadata including name, description, and inputSchema for listing tools.
    {
      name: 'docker_ps',
      description: 'List Docker containers with their status',
      inputSchema: {
        type: 'object',
        properties: {
          all: { type: 'boolean', default: false, description: 'Show all containers (default shows just running)' },
          filter: { type: 'string', description: 'Filter output based on conditions (e.g., "status=running")' },
          format: { type: 'string', enum: ['table', 'json'], default: 'table', description: 'Output format' },
          cwd: { type: 'string', description: 'Working directory' }
        }
      }
    },
  • src/index.ts:443-446 (registration)
    Dispatcher in main MCP server handler that matches 'docker_ps' tool calls, validates args with schema, and invokes the handler function.
    if (name === 'docker_ps') {
      const validated = dockerPsSchema.parse(args);
      return await dockerPs(validated);
    }
  • Helper function used by dockerPs (and other docker tools) to execute docker commands asynchronously, handling output and errors in MCP ToolResponse format.
    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
        };
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'with their status' but doesn't disclose behavioral traits like output format details, pagination, error handling, or permissions required. For a tool with 4 parameters and no annotations, this is insufficient transparency.

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 with zero waste. It's front-loaded with the core purpose and appropriately sized for the tool's complexity. 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?

Given 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain return values, error cases, or usage context. For a listing tool with multiple options, more detail is needed to guide the agent effectively.

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 4 parameters. The description adds no parameter-specific information beyond implying status listing. Baseline 3 is appropriate as the schema handles parameter semantics, but the description doesn't compensate or add value.

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 ('List') and resource ('Docker containers') with the scope of their status. It distinguishes from siblings like docker_images (lists images) and docker_compose_ps (lists Compose containers), though not explicitly. However, it lacks specific differentiation from docker_compose_ps, which is a close sibling.

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 on when to use this tool versus alternatives like docker_compose_ps or docker_inspect. The description implies listing containers but doesn't specify use cases, prerequisites, or exclusions. It's a basic statement without contextual direction.

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

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