rm
Eliminate a model by specifying its name to manage and optimize local AI model storage within the Ollama MCP Server's environment.
Instructions
Remove a model
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- src/index.ts:144-151 (handler)Handler function for the 'rm' tool that deletes the Ollama model specified by 'name' using ollama.delete() and returns the JSON result or formatted error.async ({ name }) => { try { const result = await ollama.delete({ model: name }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${formatError(error)}` }], isError: true }; } }
- src/index.ts:139-143 (schema)Schema definition for the 'rm' tool, including title, description, and input schema requiring a 'name' string parameter.{ title: "Remove model", description: "Remove a model", inputSchema: { name: z.string() }, },
- src/index.ts:137-152 (registration)Registration of the 'rm' tool using server.registerTool, specifying name, schema, and handler function.server.registerTool( "rm", { title: "Remove model", description: "Remove a model", inputSchema: { name: z.string() }, }, async ({ name }) => { try { const result = await ollama.delete({ model: name }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${formatError(error)}` }], isError: true }; } } );