Skip to main content
Glama

Restart container

restart_container

Restart a Podman container to apply configuration changes, recover from issues, or refresh the container state using the container name or ID.

Instructions

Restart a container.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
containerYesContainer name or ID

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the restart_container tool. It extracts the container name from args, runs 'podman restart' using the run_podman helper, and returns a dictionary with the output or error message.
    async def restart_container(self, args: Dict[str, Any]) -> Dict[str, Any]:
        container = args.get("container")
        result = run_podman(["restart", container])
        return {"output": f"Restarted container: {container}" if result["success"] else f"Error: {result['stderr']}"}
  • main_b.py:230-243 (registration)
    Registration of the restart_container tool in the list of tools, including name, description, and input schema definition.
    Tool(
        name="restart_container",
        description="Restart a container",
        inputSchema={
            "type": "object",
            "properties": {
                "container": {
                    "type": "string",
                    "description": "Container name or ID"
                }
            },
            "required": ["container"]
        }
    ),
  • main_b.py:464-464 (registration)
    Mapping of the tool name 'restart_container' to its handler method in the tool_handlers dictionary used in handle_tools_call.
    "restart_container": self.restart_container,
  • main.py:185-188 (handler)
    Alternative implementation of the restart_container tool using @mcp.tool decorator, which combines schema (via Field) and handler logic, calling podman restart.
    @mcp.tool(title="Restart container", description="Restart a container.")
    def restart_container(container: str = Field(..., description="Container name or ID")) -> str:
        result = run_podman(["restart", container])
        return f"Restarted container: {container}" if result["success"] else f"Error: {result['stderr']}"
  • Pydantic Field definition providing input schema for the container parameter in the restart_container tool.
    def restart_container(container: str = Field(..., description="Container name or ID")) -> str:
        result = run_podman(["restart", container])
        return f"Restarted 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 but only states the basic action without disclosing behavioral traits. It doesn't mention whether this requires specific permissions, if it's destructive (likely yes, as it stops and starts a container), potential downtime effects, rate limits, or what the output schema returns. This leaves significant gaps 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 ('Restart a container.') that is front-loaded and wastes no words. Every part of the sentence earns its place by directly stating the tool's purpose.

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 complexity (a mutation operation with potential side effects), lack of annotations, and presence of an output schema, the description is incomplete. It doesn't address safety, behavioral context, or usage guidelines, though the output schema may cover return values. This is minimally adequate but with 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?

The schema description coverage is 100%, with the single parameter 'container' clearly documented in the schema. The description adds no additional meaning beyond what the schema provides, such as format examples or constraints, so it meets the baseline score of 3 where the schema does the heavy lifting.

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 ('Restart') and resource ('a container'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'stop_container' and 'start_container' tools, which could be used in combination for similar effects, so it misses the highest 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 'stop_container' followed by 'start_container', or how it differs from 'exec_container' for restarting processes. It lacks context about prerequisites (e.g., container must be running) or exclusions, leaving usage unclear.

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