Skip to main content
Glama

List containers

list_containers

View running Podman containers or display all containers when needed to manage containerized applications and monitor container status.

Instructions

List containers (running by default, all if requested).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allNoShow all containers, not just running

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The asynchronous handler method that executes the list_containers tool by running the 'podman ps' command with optional --all flag.
    async def list_containers(self, args: Dict[str, Any]) -> Dict[str, Any]:
        all_containers = args.get("all", False)
        cmd_args = ["ps", "--format", "json"]
        if all_containers:
            cmd_args.append("--all")
        result = run_podman(cmd_args)
        return {"output": result["stdout"] if result["success"] else f"Error: {result['stderr']}"}
  • main.py:155-161 (handler)
    The handler function decorated with @mcp.tool that implements the list_containers tool using 'podman ps' command.
    @mcp.tool(title="List containers", description="List containers (running by default, all if requested).")
    def list_containers(all: bool = Field(False, description="Show all containers, not just running")) -> str:
        args = ["ps", "--format", "json"]
        if all:
            args.append("--all")
        result = run_podman(args)
        return result["stdout"] if result["success"] else f"Error: {result['stderr']}"
  • The JSON schema definition for the input parameters of the list_containers tool, specifying the optional 'all' boolean parameter.
    inputSchema={
        "type": "object",
        "properties": {
            "all": {
                "type": "boolean",
                "description": "Show all containers, not just running",
                "default": False
            }
        }
    }
  • main_b.py:459-472 (registration)
    The dictionary mapping tool names to their handler methods, registering 'list_containers' to self.list_containers.
    tool_handlers = {
        "list_containers": self.list_containers,
        "container_info": self.container_info,
        "start_container": self.start_container,
        "stop_container": self.stop_container,
        "restart_container": self.restart_container,
        "container_logs": self.container_logs,
        "run_container": self.run_container,
        "remove_container": self.remove_container,
        "exec_container": self.exec_container,
        "list_images": self.list_images,
        "pull_image": self.pull_image,
        "container_stats": self.container_stats,
    }
  • main_b.py:169-182 (registration)
    Registration of the list_containers tool in the server's tools list with name, description, and schema.
    Tool(
        name="list_containers",
        description="List containers (running by default, all if requested)",
        inputSchema={
            "type": "object",
            "properties": {
                "all": {
                    "type": "boolean",
                    "description": "Show all containers, not just running",
                    "default": False
                }
            }
        }
    ),
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the default behavior (showing running containers) and the 'all' parameter option, but doesn't describe important behavioral aspects like: what information is returned in the list, whether it's paginated, format of returned data, authentication requirements, rate limits, or error conditions. For a tool with no annotations, this leaves significant behavioral gaps.

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 extremely concise - a single sentence that efficiently conveys the core functionality. It's front-loaded with the main purpose and includes the key behavioral nuance. Every word earns its place with zero redundancy or 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 has an output schema (which handles return values), 100% parameter schema coverage, and no annotations, the description provides the minimum viable context. It states what the tool does and mentions the key parameter behavior, but doesn't address important contextual aspects like when to use versus alternatives, authentication needs, or error handling. For a simple read operation, this is adequate 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 already fully documents the single 'all' parameter. The description adds marginal value by mentioning the default behavior ('running by default') and the effect of the parameter ('all if requested'), but doesn't provide additional semantic context beyond what's in the schema. This meets the baseline 3 for high schema coverage.

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 ('containers'), making the purpose immediately understandable. It distinguishes this tool from siblings like 'container_info' or 'list_images' by focusing specifically on container enumeration. However, it doesn't explicitly differentiate from 'container_stats' which also involves containers, so it's not a perfect 5.

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 minimal guidance - it mentions the default behavior (running containers) and the option to show all containers. However, it offers no explicit guidance on when to use this tool versus alternatives like 'container_info' for detailed information or 'container_stats' for performance metrics. No prerequisites, exclusions, or comparative context with sibling tools is provided.

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/kunwarmahen/podman-mcp-server'

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