rm
Delete local AI models from the Ollama MCP Server to manage storage and organize available models.
Instructions
Remove a model
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the model to remove |
Implementation Reference
- src/index.ts:455-469 (handler)The main handler function for the 'rm' tool. It executes the 'ollama rm {name}' command using execAsync and returns the stdout or stderr as text content, or throws an error if it fails.private async handleRemove(args: any) { try { const { stdout, stderr } = await execAsync(`ollama rm ${args.name}`); return { content: [ { type: 'text', text: stdout || stderr, }, ], }; } catch (error) { throw new McpError(ErrorCode.InternalError, `Failed to remove model: ${formatError(error)}`); } }
- src/index.ts:192-206 (registration)Registration of the 'rm' tool in the listTools response, including name, description, and input schema.{ name: 'rm', description: 'Remove a model', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the model to remove', }, }, required: ['name'], additionalProperties: false, }, },
- src/index.ts:195-205 (schema)Input schema definition for the 'rm' tool, specifying an object with a required 'name' string property.inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name of the model to remove', }, }, required: ['name'], additionalProperties: false, },
- src/index.ts:272-273 (handler)Dispatch case in the main CallToolRequestSchema handler that routes 'rm' tool calls to the handleRemove function.case 'rm': return await this.handleRemove(request.params.arguments);