Skip to main content
Glama
rawveg

Ollama MCP Server

ollama_list

List all locally installed Ollama models with names, sizes, and modification dates.

Instructions

List all available Ollama models installed locally. Returns model names, sizes, and modification dates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoOutput format (default: json)json

Implementation Reference

  • The core handler function 'listModels' that executes the tool logic by calling ollama.list() and formatting the response.
    export async function listModels(
      ollama: Ollama,
      format: ResponseFormat
    ): Promise<string> {
      const response = await ollama.list();
    
      return formatResponse(JSON.stringify(response), format);
    }
  • The tool definition object with name 'ollama_list', description, inputSchema, and a handler wrapper that delegates to listModels.
    export const toolDefinition: ToolDefinition = {
      name: 'ollama_list',
      description:
        'List all available Ollama models installed locally. Returns model names, sizes, and modification dates.',
      inputSchema: {
        type: 'object',
        properties: {
          format: {
            type: 'string',
            enum: ['json', 'markdown'],
            description: 'Output format (default: json)',
            default: 'json',
          },
        },
      },
      handler: async (ollama: Ollama, args: Record<string, unknown>, format: ResponseFormat) => {
        return listModels(ollama, format);
      },
    };
  • The Zod schema 'ListModelsInputSchema' for validating ollama_list tool input, accepting an optional 'format' parameter.
     * Schema for ollama_list tool
     */
    export const ListModelsInputSchema = z.object({
      format: ResponseFormatSchema.default('json'),
    });
  • src/server.ts:48-59 (registration)
    The MCP server registration of all tools (including ollama_list) via ListToolsRequestSchema handler, which calls discoverTools() to auto-load tool definitions from the tools directory.
    // Register tool list handler
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      const tools = await discoverTools();
    
      return {
        tools: tools.map((tool) => ({
          name: tool.name,
          description: tool.description,
          inputSchema: tool.inputSchema,
        })),
      };
    });
  • ModelNotFoundError class that references 'ollama_list' in its error message, guiding users to use the list tool.
    export class ModelNotFoundError extends OllamaError {
      constructor(modelName: string) {
        super(
          `Model not found: ${modelName}. Use ollama_list to see available models.`
        );
        this.name = 'ModelNotFoundError';
      }
    }
Behavior3/5

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

No annotations are provided, so the description must fully disclose behavior. It states the return fields (names, sizes, dates) but lacks detail on read-only nature, authentication needs, or edge cases like empty results. For a simple listing tool, this is adequate but not thorough.

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, front-loaded sentence that conveys all essential information. No unnecessary words, making it highly efficient for an AI agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity, one optional parameter, and no output schema required, the description fully covers what the agent needs: the action, the result contents, and the optional format. No gaps are evident.

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 one parameter ('format') with complete description in the schema itself (enum and default). The tool description adds no extra semantic value beyond what the schema already provides, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List'), the resource ('all available Ollama models installed locally'), and the returned information ('model names, sizes, and modification dates'). It effectively distinguishes from sibling tools like ollama_show or ollama_ps by focusing on listing local models.

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 the usage context (listing installed models) but does not provide explicit guidance on when to use this tool versus alternatives like ollama_show for details or ollama_ps for running models. No exclusions or prerequisites are mentioned.

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/rawveg/ollama-mcp'

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