ollama_copy
Create a duplicate of an existing Ollama model with a new name for backup, testing, or versioning purposes.
Instructions
Copy a model. Creates a duplicate of an existing model with a new name.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Name of the source model | |
| destination | Yes | Name for the copied model | |
| format | No | json |
Implementation Reference
- src/tools/copy.ts:10-22 (handler)The core handler function that performs the model copy operation using the Ollama client's copy method and formats the response.export async function copyModel( ollama: Ollama, source: string, destination: string, format: ResponseFormat ): Promise<string> { const response = await ollama.copy({ source, destination, }); return formatResponse(JSON.stringify(response), format); }
- src/schemas.ts:184-191 (schema)Zod schema defining the input parameters for the ollama_copy tool: source model name, destination name, and optional format./** * Schema for ollama_copy tool */ export const CopyModelInputSchema = z.object({ source: z.string().min(1), destination: z.string().min(1), format: ResponseFormatSchema.default('json'), });
- src/tools/copy.ts:24-51 (registration)Tool registration definition including name, description, input schema (for MCP/JSON schema), and handler that validates inputs using Zod schema and calls the copyModel function. This is auto-loaded by the autoloader.export const toolDefinition: ToolDefinition = { name: 'ollama_copy', description: 'Copy a model. Creates a duplicate of an existing model with a new name.', inputSchema: { type: 'object', properties: { source: { type: 'string', description: 'Name of the source model', }, destination: { type: 'string', description: 'Name for the copied model', }, format: { type: 'string', enum: ['json', 'markdown'], default: 'json', }, }, required: ['source', 'destination'], }, handler: async (ollama: Ollama, args: Record<string, unknown>, format: ResponseFormat) => { const validated = CopyModelInputSchema.parse(args); return copyModel(ollama, validated.source, validated.destination, format); }, };