Skip to main content
Glama
rawveg

Ollama MCP Server

ollama_delete

Remove a local model to free up disk space by deleting it from storage.

Instructions

Delete a model from local storage. Removes the model and frees up disk space.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesName of the model to delete
formatNojson

Implementation Reference

  • Core implementation of the ollama_delete tool. Calls ollama.delete({model}) to delete the specified model and formats the response.
    export async function deleteModel(
      ollama: Ollama,
      model: string,
      format: ResponseFormat
    ): Promise<string> {
      const response = await ollama.delete({
        model,
      });
    
      return formatResponse(JSON.stringify(response), format);
    }
  • ToolDefinition export that registers the 'ollama_delete' tool, including its name, description, input schema (JSON Schema format), and handler function that validates input using Zod schema and calls the core deleteModel function.
    export const toolDefinition: ToolDefinition = {
      name: 'ollama_delete',
      description:
        'Delete a model from local storage. Removes the model and frees up disk space.',
      inputSchema: {
        type: 'object',
        properties: {
          model: {
            type: 'string',
            description: 'Name of the model to delete',
          },
          format: {
            type: 'string',
            enum: ['json', 'markdown'],
            default: 'json',
          },
        },
        required: ['model'],
      },
      handler: async (ollama: Ollama, args: Record<string, unknown>, format: ResponseFormat) => {
        const validated = DeleteModelInputSchema.parse(args);
        return deleteModel(ollama, validated.model, format);
      },
    };
  • Zod schema for validating input parameters of the ollama_delete tool (model name and optional format). Used in the tool handler for runtime validation.
    /**
     * Schema for ollama_delete tool
     */
    export const DeleteModelInputSchema = z.object({
      model: z.string().min(1),
      format: ResponseFormatSchema.default('json'),
    });

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