Skip to main content
Glama

Remove container

remove_container

Delete a container from the Podman MCP Server by specifying its name or ID. Use the force option to remove running containers.

Instructions

Remove a container.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
containerYesContainer name or ID
forceNoForce remove running container

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'remove_container' tool. It extracts container name/ID and force flag from args, constructs 'podman rm [-f] container' command, executes it via run_podman helper, and returns success/error output.
    async def remove_container(self, args: Dict[str, Any]) -> Dict[str, Any]:
        container = args.get("container")
        force = args.get("force", False)
        cmd_args = ["rm"]
        if force:
            cmd_args.append("-f")
        cmd_args.append(container)
        result = run_podman(cmd_args)
        return {"output": f"Removed container: {container}" if result["success"] else f"Error: {result['stderr']}"}
  • Input schema definition for the remove_container tool, specifying required 'container' string and optional 'force' boolean.
    Tool(
        name="remove_container",
        description="Remove a container",
        inputSchema={
            "type": "object",
            "properties": {
                "container": {
                    "type": "string",
                    "description": "Container name or ID"
                },
                "force": {
                    "type": "boolean",
                    "description": "Force remove running container",
                    "default": False
                }
            },
            "required": ["container"]
        }
    ),
  • main_b.py:459-472 (registration)
    Dictionary mapping tool names to handler methods, registering 'remove_container' to self.remove_container in the tools/call handler.
    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.py:227-236 (handler)
    Alternative implementation of the 'remove_container' tool using FastMCP decorator, with pydantic-typed parameters serving as schema. Executes identical podman rm logic.
    def remove_container(
        container: str = Field(..., description="Container name or ID"),
        force: bool = Field(False, description="Force remove running container"),
    ) -> str:
        args = ["rm"]
        if force:
            args.append("-f")
        args.append(container)
        result = run_podman(args)
        return f"Removed container: {container}" if result["success"] else f"Error: {result['stderr']}"
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 'Remove a container' but doesn't explain if this is destructive, irreversible, requires specific permissions, or has side effects. The lack of detail makes it insufficient for a mutation tool.

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 with a single sentence, 'Remove a container.', which is front-loaded and wastes no words. It efficiently conveys the core action without unnecessary elaboration.

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 this is a mutation tool with no annotations, the description is incomplete. It doesn't cover behavioral aspects like destructiveness or permissions, and while an output schema exists, the description doesn't hint at return values or error conditions. More context is needed for safe and effective use.

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 input schema fully documents the parameters ('container' and 'force'). The description adds no additional meaning beyond what the schema provides, such as explaining the implications of the 'force' parameter. Baseline 3 is appropriate when the schema handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('Remove') and target ('a container'), which provides a basic purpose. However, it doesn't differentiate from sibling tools like 'stop_container' or specify what removal entails (e.g., deletion vs. stopping). This makes it vague compared to more specific alternatives.

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 such as 'stop_container' or 'restart_container'. The description lacks context about prerequisites, consequences, or typical use cases, leaving the agent without clear usage instructions.

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