Skip to main content
Glama

list_images

Display available container images from Podman to manage your containerized applications and perform image-related operations.

Instructions

List container images.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allNoShow all images including intermediate

Implementation Reference

  • The main execution logic for the list_images tool: runs 'podman images --format json' with optional --all flag based on input args, returns stdout as JSON or error message.
    async def list_images(self, args: Dict[str, Any]) -> Dict[str, Any]: all_images = args.get("all", False) cmd_args = ["images", "--format", "json"] if all_images: cmd_args.append("--all") result = run_podman(cmd_args) return {"output": result["stdout"] if result["success"] else f"Error: {result['stderr']}"}
  • main.py:249-255 (handler)
    The tool handler decorated with @mcp.tool, including inline schema via Pydantic Field; executes 'podman images' similarly.
    @mcp.tool(title="List images", description="List container images.") def list_images(all: bool = Field(False, description="Show all images including intermediate")) -> str: args = ["images", "--format", "json"] if all: args.append("--all") result = run_podman(args) return result["stdout"] if result["success"] else f"Error: {result['stderr']}"
  • Explicit input schema registration for list_images tool in the tools list, defining optional 'all' boolean parameter.
    Tool( name="list_images", description="List container images", inputSchema={ "type": "object", "properties": { "all": { "type": "boolean", "description": "Show all images including intermediate", "default": False } } } ),
  • main_b.py:459-472 (registration)
    Registration of tool handlers mapping, linking 'list_images' string to the list_images method.
    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, }
  • Helper function used by list_images to execute podman commands and capture structured output.
    def run_podman(args: List[str]) -> Dict[str, Any]: """Run a podman command and capture output""" try: cmd = ["podman"] + args logger.info(f"Running command: {' '.join(cmd)}") result = subprocess.run( cmd, capture_output=True, text=True, timeout=30 ) return { "success": result.returncode == 0, "stdout": result.stdout.strip(), "stderr": result.stderr.strip(), "returncode": result.returncode, } except subprocess.TimeoutExpired: logger.error("Command timed out") return {"success": False, "stdout": "", "stderr": "Command timed out", "returncode": -1} except Exception as e: logger.error(f"Command error: {e}") return {"success": False, "stdout": "", "stderr": str(e), "returncode": -1}

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