Skip to main content
Glama
TrueOleg

MCP Mac Apps Server

by TrueOleg

ollama_list_models

Retrieve available Ollama models to identify and select AI models for use with the MCP Mac Apps Server, which controls macOS applications through natural language commands.

Instructions

Получает список доступных моделей Ollama

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that lists available Ollama models by querying the /api/tags endpoint, formatting model names and sizes, and handling connection errors.
    private async ollamaListModels() {
      try {
        const response = await fetch(`${OLLAMA_API_URL}/api/tags`, {
          method: "GET",
          headers: {
            "Content-Type": "application/json",
          },
        });
    
        if (!response.ok) {
          const errorText = await response.text();
          throw new Error(
            `Ollama API error: ${response.status} ${errorText}`
          );
        }
    
        const data = (await response.json()) as { models?: Array<{ name: string; size: number }> };
        const models = data.models || [];
        
        if (models.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: "Нет доступных моделей. Загрузите модель: ollama pull llama3.2",
              },
            ],
          };
        }
    
        const modelList = models
          .map((m) => `- ${m.name} (${(m.size / 1024 / 1024 / 1024).toFixed(2)} GB)`)
          .join("\n");
    
        return {
          content: [
            {
              type: "text",
              text: `Доступные модели Ollama:\n${modelList}`,
            },
          ],
        };
      } catch (error) {
        if (error instanceof TypeError && error.message.includes("fetch")) {
          throw new Error(
            `Не удалось подключиться к Ollama серверу (${OLLAMA_API_URL}). Убедитесь, что Ollama запущен: ollama serve`
          );
        }
        throw new Error(
          `Ошибка получения списка моделей: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Handler function that lists available Ollama models by querying the /api/tags endpoint using requests, formatting model names and sizes, and handling errors.
    def ollama_list_models() -> str:
        """Gets list of Ollama models"""
        try:
            response = requests.get(f"{OLLAMA_API_URL}/api/tags", timeout=10)
            response.raise_for_status()
            data = response.json()
            models = data.get("models", [])
    
            if not models:
                return "No available models. Load a model: ollama pull llama3.2"
    
            model_list = "\n".join(
                [
                    f"- {model['name']} ({(model.get('size', 0) / 1024 / 1024 / 1024):.2f} GB)"
                    for model in models
                ]
            )
            return f"Available Ollama models:\n{model_list}"
        except requests.exceptions.ConnectionError:
            raise Exception(
                f"Failed to connect to Ollama server ({OLLAMA_API_URL}). "
                "Make sure Ollama is running: ollama serve"
            )
        except Exception as e:
            raise Exception(f"Error getting list of models: {str(e)}")
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    {
      name: "ollama_list_models",
      description: "Получает список доступных моделей Ollama",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    {
        "name": "ollama_list_models",
        "description": "Gets list of available Ollama models",
        "inputSchema": {
            "type": "object",
            "properties": {},
        },
    },
  • src/index.ts:335-337 (registration)
    Registration in the tool dispatch switch statement mapping tool name to handler call.
    case "ollama_list_models":
      return await this.ollamaListModels();
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It only states what the tool does ('gets list of available Ollama models') without describing any behavioral traits - no information about permissions needed, rate limits, response format, whether it's cached or real-time, or any side effects. For a tool with zero annotation coverage, this is insufficient behavioral transparency.

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 without any unnecessary words. It's appropriately sized for a simple list operation and front-loads the essential information. Every word earns its place in this minimal description.

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 tool has no annotations, no output schema, and zero parameters, the description is incomplete for proper agent usage. While the purpose is clear, there's no information about what the response contains (model names, versions, sizes, etc.), how results are formatted, or any behavioral context. For even a simple list operation, the agent needs more guidance about what to expect from the output.

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 tool has zero parameters (schema coverage 100%), so there are no parameters to document. The description correctly doesn't attempt to describe non-existent parameters. The baseline for zero parameters is 4, as there's nothing to compensate for and no misleading parameter 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 action ('Получает' - gets/retrieves) and resource ('список доступных моделей Ollama' - list of available Ollama models). It specifies the exact resource type (Ollama models) which distinguishes it from other list operations like mongodb_list_collections or mongodb_list_databases. However, it doesn't explicitly differentiate from sibling tool ollama_generate, which is a different type of 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. It doesn't mention prerequisites, appropriate contexts, or when not to use it. While the purpose is clear, there's no usage guidance beyond the basic function description.

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/TrueOleg/MCP-expirements'

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