Skip to main content
Glama

docker_list_containers

List Docker containers to view their status, images, and ports for monitoring and management. Use the 'all' parameter to include stopped containers.

Instructions

List Docker containers with their status, image, and ports

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allNoShow all containers (default: only running)

Implementation Reference

  • The handler function implementation for listing docker containers.
    export async function listContainers(args: Record<string, unknown>): Promise<string> {
      const docker = getDockerClient();
      const all = (args.all as boolean) || false;
      const containers = await docker.listContainers({ all });
    
      if (containers.length === 0) {
        return all ? "No containers found." : "No running containers found.";
      }
    
      const headers = ["ID", "NAME", "IMAGE", "STATUS", "PORTS"];
      const rows = containers.map((c) => [
        c.Id.substring(0, 12),
        (c.Names?.[0] || "").replace(/^\//, ""),
        c.Image,
        c.Status,
        (c.Ports || []).map((p) =>
          p.PublicPort ? `${p.PublicPort}→${p.PrivatePort}/${p.Type}` : `${p.PrivatePort}/${p.Type}`
        ).join(", "),
      ]);
    
      return `Containers${all ? " (all)" : " (running)"}:\n\n${formatTable(headers, rows)}`;
    }
  • Registration of the docker_list_containers tool.
    {
      name: "docker_list_containers",
      description: "List Docker containers with their status, image, and ports",
      inputSchema: {
        type: "object" as const,
        properties: {
          all: { type: "boolean", description: "Show all containers (default: only running)" },
        },
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions what information is listed but doesn't cover aspects like permissions required, rate limits, output format, pagination, or whether it's a read-only operation. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 front-loads the core action and key outputs. There's no wasted verbiage, and it directly communicates the essential information without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavior, usage context, and output format, which are important for an agent to invoke it correctly in a crowded toolset. It meets a bare minimum but has clear gaps.

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 the single parameter ('all'). The description doesn't add any parameter-specific details beyond what's in the schema, such as default behavior implications. With high schema coverage, a baseline score of 3 is appropriate as the description doesn't compensate but also doesn't need to.

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 verb ('List') and resource ('Docker containers') with specific attributes ('status, image, and ports'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'docker_compose_ps' or 'docker_container_stats', which might also list containers in different contexts.

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. With many sibling tools (e.g., 'docker_compose_ps' for Compose-managed containers, 'docker_container_stats' for performance metrics), the description lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage.

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/batu-sonmez/infraclaude'

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