ollama_create
Create custom AI models by specifying a base model and customizing behavior with system prompts, templates, and other parameters.
Instructions
Create a new model with structured parameters. Allows customization of model behavior, system prompts, and templates.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Name for the new model | |
| from | Yes | Base model to derive from (e.g., llama2, llama3) | |
| system | No | System prompt for the model | |
| template | No | Prompt template to use | |
| license | No | License for the model | |
| format | No | json |
Implementation Reference
- src/tools/create.ts:70-83 (handler)Handler function for the ollama_create tool. Parses args with CreateModelInputSchema, then calls createModel() with the validated inputs.
handler: async (ollama: Ollama, args: Record<string, unknown>, format: ResponseFormat) => { const validated = CreateModelInputSchema.parse(args); return createModel( ollama, { model: validated.model, from: validated.from, system: validated.system, template: validated.template, license: validated.license, }, format ); }, - src/tools/create.ts:18-33 (helper)Core createModel function that calls ollama.create() and formats the response.
export async function createModel( ollama: Ollama, options: CreateModelOptions, format: ResponseFormat ): Promise<string> { const response = await ollama.create({ model: options.model, from: options.from, system: options.system, template: options.template, license: options.license, stream: false, }); return formatResponse(JSON.stringify(response), format); } - src/tools/create.ts:35-84 (registration)Tool definition registration object with name 'ollama_create', description, inputSchema, and handler. Auto-discovered by autoloader.
export const toolDefinition: ToolDefinition = { name: 'ollama_create', description: 'Create a new model with structured parameters. Allows customization of model behavior, system prompts, and templates.', inputSchema: { type: 'object', properties: { model: { type: 'string', description: 'Name for the new model', }, from: { type: 'string', description: 'Base model to derive from (e.g., llama2, llama3)', }, system: { type: 'string', description: 'System prompt for the model', }, template: { type: 'string', description: 'Prompt template to use', }, license: { type: 'string', description: 'License for the model', }, format: { type: 'string', enum: ['json', 'markdown'], default: 'json', }, }, required: ['model', 'from'], }, handler: async (ollama: Ollama, args: Record<string, unknown>, format: ResponseFormat) => { const validated = CreateModelInputSchema.parse(args); return createModel( ollama, { model: validated.model, from: validated.from, system: validated.system, template: validated.template, license: validated.license, }, format ); }, }; - src/schemas.ts:167-174 (schema)Zod schema CreateModelInputSchema defining validation for model, from, system, template, license, and format fields.
export const CreateModelInputSchema = z.object({ model: z.string().min(1), from: z.string().min(1), system: z.string().optional(), template: z.string().optional(), license: z.string().optional(), format: ResponseFormatSchema.default('json'), });