Skip to main content
Glama

ollama_delete

Remove a local AI model to free up disk space. This tool deletes specified models from your Ollama MCP Server 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

  • The core handler function that executes the ollama.delete API call 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); }
  • Registers the 'ollama_delete' tool with its name, description, input schema, and handler function that performs validation and calls the core deleteModel.
    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 input schema used for validating the tool arguments, imported and used in the handler.
    /** * 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