Skip to main content
Glama

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

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']}"

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