Skip to main content
Glama

list-containers

Retrieve and display all Docker containers currently running or stopped on your system for container management.

Instructions

List all Docker containers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list-containers' tool. It lists all Docker containers (including stopped ones) using the python_on_whales DockerClient, formats their ID, name, and status, and returns the list as text content.
    @staticmethod
    async def handle_list_containers(arguments: Dict[str, Any]) -> List[TextContent]:
        debug_info = []
        try:
            debug_info.append("Listing all Docker containers")
            containers = await asyncio.to_thread(docker_client.container.list, all=True)
            container_list = "\n".join(
                [f"{c.id[:12]} - {c.name} - {c.state.status}" for c in containers])
    
            return [TextContent(type="text", text=f"All Docker Containers:\n{container_list}\n\nDebug Info:\n{chr(10).join(debug_info)}")]
        except Exception as e:
            debug_output = "\n".join(debug_info)
            return [TextContent(type="text", text=f"Error listing containers: {str(e)}\n\nDebug Information:\n{debug_output}")]
  • Registration of the 'list-containers' tool in the @server.list_tools() handler, defining its name, description, and empty input schema (no arguments required).
    types.Tool(
        name="list-containers",
        description="List all Docker containers",
        inputSchema={
            "type": "object",
            "properties": {}
        }
    )
  • Input schema for the 'list-containers' tool, indicating it takes no arguments (empty properties).
    inputSchema={
        "type": "object",
        "properties": {}
    }
  • Dispatch in the @server.call_tool() handler that routes 'list-containers' calls to the DockerHandlers.handle_list_containers method.
    elif name == "list-containers":
        return await DockerHandlers.handle_list_containers(arguments)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('List all') but lacks details on permissions, rate limits, output format, or any constraints (e.g., whether it includes stopped containers). This is a significant gap for a tool with zero annotation coverage.

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 no wasted words. It is front-loaded and directly states the tool's purpose, making it highly concise and well-structured for quick understanding.

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 lack of annotations and output schema, the description is incomplete. It fails to provide necessary behavioral context (e.g., what 'all' entails, response format) or usage guidelines, making it inadequate for a tool that might have hidden complexities despite having no parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, but this is acceptable given the schema's completeness, aligning with the baseline of 4 for zero parameters.

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 'List all Docker containers' clearly states the verb ('List') and resource ('Docker containers'), making the purpose immediately understandable. However, it doesn't differentiate from potential sibling tools like 'get-logs' which might also list containers but with logs, so it misses full sibling distinction.

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?

The description provides no guidance on when to use this tool versus alternatives like 'create-container' or 'deploy-compose'. There is no mention of context, prerequisites, or exclusions, leaving the agent to infer usage based on tool names alone.

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

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