Skip to main content
Glama

list_vllm_containers

Lists all vLLM Docker containers to monitor running instances and manage container status across platforms.

Instructions

List all vLLM Docker containers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allNoShow all containers including stopped ones

Implementation Reference

  • The main handler function that implements list_vllm_containers. It gets platform info, checks if runtime is running, constructs and executes the 'docker ps' or 'podman ps' command with optional '-a' flag, and returns formatted container information as TextContent.
    async def list_vllm_containers(arguments: dict[str, Any]) -> list[TextContent]:
        """
        List all vLLM-related containers.
    
        Args:
            arguments: Dictionary containing:
                - all: Show all containers including stopped (default: False)
    
        Returns:
            List of TextContent with container information.
        """
        platform_info = await get_platform_info()
        if not platform_info.runtime_running:
            runtime_name = platform_info.container_runtime.value.capitalize() if platform_info.container_runtime != ContainerRuntime.NONE else "Container runtime"
            return [TextContent(type="text", text=f"❌ Error: {runtime_name} is not running.")]
    
        runtime_cmd = _get_runtime_cmd(platform_info.container_runtime)
        show_all = arguments.get("all", False)
        
        cmd = [runtime_cmd, "ps"]
        if show_all:
            cmd.append("-a")
        cmd.extend([
            "--format", "table {{.Names}}\t{{.Status}}\t{{.Ports}}\t{{.Image}}"
        ])
        
        exit_code, stdout, stderr = await _run_command(cmd)
        
        if exit_code != 0:
            return [TextContent(type="text", text=f"❌ Error listing containers: {stderr}")]
        
        if not stdout.strip() or stdout.strip() == "NAMES\tSTATUS\tPORTS\tIMAGE":
            return [TextContent(
                type="text",
                text="ℹ️ No containers found.\n\nUse `start_vllm` to create one."
            )]
        
        runtime_name = platform_info.container_runtime.value.capitalize()
        return [TextContent(
            type="text",
            text=f"## {runtime_name} Containers\n\n```\n{stdout}\n```"
        )]
  • Tool registration with name, description, and input schema defining the 'all' boolean parameter that controls whether stopped containers are shown.
        name="list_vllm_containers",
        description="List all vLLM Docker containers",
        inputSchema={
            "type": "object",
            "properties": {
                "all": {
                    "type": "boolean",
                    "description": "Show all containers including stopped ones",
                    "default": False,
                },
            },
        },
    ),
  • The tool invocation handler that routes calls to list_vllm_containers to the actual handler function.
    elif name == "list_vllm_containers":
        return await list_vllm_containers(arguments)
  • Helper function _get_runtime_cmd that returns the appropriate container runtime command ('podman' or 'docker') based on the ContainerRuntime enum.
    def _get_runtime_cmd(runtime: ContainerRuntime) -> str:
        """Get the command for the container runtime."""
        if runtime == ContainerRuntime.PODMAN:
            return "podman"
        return "docker"
  • Helper function _run_command that executes shell commands asynchronously using asyncio subprocess, handling timeouts and exceptions, and returning exit code, stdout, and stderr.
    async def _run_command(cmd: list[str], timeout: float = 30.0) -> tuple[int, str, str]:
        """Run a shell command and return exit code, stdout, stderr."""
        try:
            process = await asyncio.create_subprocess_exec(
                *cmd,
                stdout=asyncio.subprocess.PIPE,
                stderr=asyncio.subprocess.PIPE,
            )
            stdout, stderr = await asyncio.wait_for(
                process.communicate(),
                timeout=timeout,
            )
            return (
                process.returncode or 0,
                stdout.decode("utf-8"),
                stderr.decode("utf-8"),
            )
        except asyncio.TimeoutError:
            return (1, "", "Command timed out")
        except Exception as e:
            return (1, "", str(e))
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 what the tool does but doesn't describe how it behaves—such as whether it returns real-time or cached data, what format the output takes, if there are rate limits, or any error conditions. This leaves significant gaps for a tool that interacts with Docker containers.

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 that directly states the tool's function without unnecessary words. It's front-loaded with the core purpose and wastes no space, making it easy for an agent to parse quickly.

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 the lack of annotations and output schema, the description is incomplete for a tool that lists Docker containers. It doesn't explain what information is returned (e.g., container IDs, statuses, names), how results are formatted, or any behavioral aspects like pagination or error handling, leaving the agent with insufficient context for reliable 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?

The input schema has 100% description coverage, with the single parameter 'all' clearly documented in the schema. The description adds no additional parameter information beyond what's in the schema, which is acceptable given the high schema coverage, resulting in a baseline score of 3.

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 ('List') and target resource ('vLLM Docker containers'), making the purpose immediately understandable. It doesn't differentiate from siblings like 'list_models' or 'get_vllm_logs', but the specificity of 'vLLM Docker containers' provides adequate clarity for a listing operation.

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 'list_models', 'vllm_status', or 'get_vllm_logs'. There's no mention of prerequisites, context for usage, or comparison with sibling tools, leaving the agent to infer usage 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/micytao/vllm-mcp-server'

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