Skip to main content
Glama

list_models

Retrieve available models from the vLLM server to identify which AI models are accessible for deployment and use.

Instructions

List all available models on the vLLM server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main list_models handler function that retrieves available models from the vLLM server and formats them as TextContent. It handles errors and returns formatted markdown output with model details (id, owned_by, created).
    async def list_models() -> list[TextContent]:
        """
        List all available models on the vLLM server.
    
        Returns:
            List of TextContent with model information.
        """
        try:
            async with VLLMClient() as client:
                models = await client.list_models()
    
                if not models:
                    return [TextContent(type="text", text="No models available on the vLLM server.")]
    
                # Format model list
                model_list = []
                for model in models:
                    model_id = model.get("id", "unknown")
                    owned_by = model.get("owned_by", "unknown")
                    created = model.get("created", "unknown")
                    model_list.append(f"- **{model_id}** (owned by: {owned_by}, created: {created})")
    
                result = f"## Available Models ({len(models)} total)\n\n" + "\n".join(model_list)
                return [TextContent(type="text", text=result)]
    
        except VLLMClientError as e:
            return [TextContent(type="text", text=f"Error listing models: {str(e)}")]
  • Tool registration that defines the list_models tool with its name, description, and input schema (empty object, meaning no parameters required).
    Tool(
        name="list_models",
        description="List all available models on the vLLM server",
        inputSchema={
            "type": "object",
            "properties": {},
        },
    ),
  • Handler invocation in the call_tool function that routes the list_models tool name to the actual handler function.
    elif name == "list_models":
        return await list_models()
  • VLLMClient helper method that makes the actual HTTP GET request to the vLLM server's /models endpoint and returns the model data as a list of dictionaries.
    async def list_models(self) -> list[dict[str, Any]]:
        """List available models."""
        session = await self._get_session()
        try:
            async with session.get(
                f"{self.base_url}/models",
                headers=self.headers,
            ) as response:
                if response.status != 200:
                    body = await response.text()
                    raise VLLMAPIError(
                        f"Failed to list models: {response.status}",
                        response.status,
                        body,
                    )
                data = await response.json()
                return data.get("data", [])
  • Import statement that brings the list_models function into scope for tool registration and invocation.
    from vllm_mcp_server.tools.models import get_model_info, list_models
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('List all available models') but lacks details on permissions, rate limits, pagination, or response format. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

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 purpose with zero waste. It's front-loaded and appropriately sized for a simple listing tool, making it easy to parse quickly.

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 simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate but lacks completeness. It doesn't address behavioral aspects like what 'available' means, potential errors, or how the list is formatted, which could be important for an AI agent to use it correctly in context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't mention parameters, aligning with the schema. A baseline of 4 is applied as it correctly handles the absence of parameters without adding unnecessary information.

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 verb ('List') and resource ('all available models on the vLLM server'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_model_info' or 'vllm_status', which might provide overlapping or related information about models.

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. With siblings like 'get_model_info' (likely for details on a specific model) and 'vllm_status' (possibly for server status including models), there's no indication of context, prerequisites, or exclusions for this listing operation.

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