Skip to main content
Glama

list-available-models

Discover which AI models are accessible for querying through the Multi-Model Advisor to obtain diverse perspectives on your questions.

Instructions

List all available models in Ollama that can be used with query-models

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that fetches the list of available models from the Ollama API, formats the information including model sizes, parameter counts, quantization levels, and indicates which default models are available.
        try {
          const response = await fetch(`${OLLAMA_API_URL}/api/tags`);
          
          if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
          }
          
          const data = await response.json() as { models: OllamaModel[] };
          
          if (!data.models || !Array.isArray(data.models)) {
            return {
              content: [
                {
                  type: "text",
                  text: "No models found or unexpected response format from Ollama API."
                }
              ]
            };
          }
          
          // Format model information
          const modelInfo = data.models.map(model => {
            const size = (model.size / (1024 * 1024 * 1024)).toFixed(2); // Convert to GB
            const paramSize = model.details?.parameter_size || "Unknown";
            const quantLevel = model.details?.quantization_level || "Unknown";
            
            return `- **${model.name}**: ${paramSize} parameters, ${size} GB, ${quantLevel} quantization`;
          }).join("\n");
          
          // Show which models are currently configured as defaults
          const defaultModelsInfo = DEFAULT_MODELS.map(model => {
            const isAvailable = data.models.some(m => m.name === model);
            return `- **${model}**: ${isAvailable ? "✓ Available" : "⚠️ Not available"}`;
          }).join("\n");
          
          return {
            content: [
              {
                type: "text",
                text: `# Available Ollama Models\n\n${modelInfo}\n\n## Current Default Models\n\n${defaultModelsInfo}\n\nYou can use any of the available models with the query-models tool by specifying them in the 'models' parameter.`
              }
            ]
          };
        } catch (error) {
          console.error("Error listing models:", error);
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Error listing models: ${error instanceof Error ? error.message : String(error)}\n\nMake sure Ollama is running and accessible at ${OLLAMA_API_URL}.`
              }
            ]
          };
        }
      }
    );
  • src/index.ts:68-129 (registration)
    The registration of the 'list-available-models' tool using McpServer.tool method, specifying name, description, empty input schema, and inline handler function.
      "list-available-models",
      "List all available models in Ollama that can be used with query-models",
      {},
      async () => {
        try {
          const response = await fetch(`${OLLAMA_API_URL}/api/tags`);
          
          if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
          }
          
          const data = await response.json() as { models: OllamaModel[] };
          
          if (!data.models || !Array.isArray(data.models)) {
            return {
              content: [
                {
                  type: "text",
                  text: "No models found or unexpected response format from Ollama API."
                }
              ]
            };
          }
          
          // Format model information
          const modelInfo = data.models.map(model => {
            const size = (model.size / (1024 * 1024 * 1024)).toFixed(2); // Convert to GB
            const paramSize = model.details?.parameter_size || "Unknown";
            const quantLevel = model.details?.quantization_level || "Unknown";
            
            return `- **${model.name}**: ${paramSize} parameters, ${size} GB, ${quantLevel} quantization`;
          }).join("\n");
          
          // Show which models are currently configured as defaults
          const defaultModelsInfo = DEFAULT_MODELS.map(model => {
            const isAvailable = data.models.some(m => m.name === model);
            return `- **${model}**: ${isAvailable ? "✓ Available" : "⚠️ Not available"}`;
          }).join("\n");
          
          return {
            content: [
              {
                type: "text",
                text: `# Available Ollama Models\n\n${modelInfo}\n\n## Current Default Models\n\n${defaultModelsInfo}\n\nYou can use any of the available models with the query-models tool by specifying them in the 'models' parameter.`
              }
            ]
          };
        } catch (error) {
          console.error("Error listing models:", error);
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Error listing models: ${error instanceof Error ? error.message : String(error)}\n\nMake sure Ollama is running and accessible at ${OLLAMA_API_URL}.`
              }
            ]
          };
        }
      }
    );
  • Empty input schema (Zod object) for the tool, indicating no parameters are required.
    async () => {
  • TypeScript interface defining the structure of an Ollama model object, used in the handler to type the API response and access model details.
    interface OllamaModel {
      name: string;
      modified_at: string;
      size: number;
      digest: string;
      details: {
        format: string;
        family: string;
        families: string[];
        parameter_size: string;
        quantization_level: string;
      };
    }
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 it 'List all available models' but doesn't describe what 'available' means (e.g., locally installed, remote, with status), how results are returned (e.g., format, pagination), or any constraints (e.g., permissions, rate limits). This leaves significant gaps in understanding the tool's behavior.

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 and references the sibling tool. It is front-loaded with the core action and resource, with no wasted words or unnecessary elaboration, making it highly concise and well-structured.

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 has 0 parameters, no annotations, and no output schema, the description is minimally adequate by stating what it does. However, it lacks details on behavior (e.g., output format, what 'available' entails) and doesn't leverage the low complexity to provide more context, making it incomplete for fully informed use without additional assumptions.

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 doesn't add parameter details, which is appropriate here. A baseline of 4 is applied as it effectively handles the lack of parameters without introducing confusion or redundancy.

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 the resource 'all available models in Ollama', which provides a specific purpose. It distinguishes from the sibling tool 'query-models' by indicating these models are 'used with' it, though it doesn't explicitly differentiate their functions beyond that implied relationship.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning the sibling tool 'query-models', suggesting this tool is for discovering models to use with it. However, it lacks explicit guidance on when to use this tool versus alternatives or any prerequisites, leaving usage context somewhat inferred rather than clearly stated.

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/YuChenSSR/multi-ai-advisor-mcp'

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