Skip to main content
Glama

Stop container

stop_container

Stop a running Podman container by name or ID. Configure timeout period before automatic termination to manage container lifecycle operations.

Instructions

Stop a running container.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
containerYesContainer name or ID
timeoutNoSeconds to wait before killing container

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler function that stops the specified container using the podman stop command with an optional timeout.
    async def stop_container(self, args: Dict[str, Any]) -> Dict[str, Any]:
        container = args.get("container")
        timeout = args.get("timeout", 10)
        result = run_podman(["stop", "-t", str(timeout), container])
        return {"output": f"Stopped container: {container}" if result["success"] else f"Error: {result['stderr']}"}
  • Input schema definition for the stop_container tool, specifying container (required) and optional timeout.
    Tool(
        name="stop_container",
        description="Stop a running container",
        inputSchema={
            "type": "object",
            "properties": {
                "container": {
                    "type": "string",
                    "description": "Container name or ID"
                },
                "timeout": {
                    "type": "integer",
                    "description": "Seconds to wait before killing container",
                    "default": 10
                }
            },
            "required": ["container"]
        }
    ),
  • main_b.py:459-472 (registration)
    Registration of tool handlers in the dictionary used to dispatch tool calls to the appropriate methods.
    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:176-182 (handler)
    Handler function decorated with @mcp.tool that stops the container using podman, with schema defined via Field annotations.
    @mcp.tool(title="Stop container", description="Stop a running container.")
    def stop_container(
        container: str = Field(..., description="Container name or ID"),
        timeout: int = Field(10, description="Seconds to wait before killing container"),
    ) -> str:
        result = run_podman(["stop", "-t", str(timeout), container])
        return f"Stopped 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 full burden for behavioral disclosure. While 'Stop' implies a state change, it doesn't clarify whether this is reversible, what permissions are required, or what happens to container data. The description lacks details about side effects, error conditions, or rate limits that would help the agent understand operational implications.

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 wasted words. It's appropriately front-loaded with the core action and target, making it easy for an agent to parse quickly 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 that this is a mutation tool with no annotations but has an output schema (which handles return values), the description is minimally adequate. However, for a tool that changes container state, more behavioral context would be helpful despite the output schema covering response format.

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 both parameters. The description adds no additional meaning about parameters beyond what's in the schema (e.g., it doesn't explain container identification nuances or timeout behavior implications). This meets the baseline 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 action ('Stop') and target ('a running container'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'restart_container' or 'remove_container', which prevents a perfect score.

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 'restart_container' or 'remove_container'. It doesn't mention prerequisites (e.g., container must be running) or exclusions, leaving the agent to infer usage context from the tool name 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/kunwarmahen/podman-mcp-server'

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