ollama_create
Create custom AI models by specifying base models, system prompts, and templates to tailor model behavior for specific tasks.
Instructions
Create a new model with structured parameters. Allows customization of model behavior, system prompts, and templates.
Input Schema
TableJSON 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:18-33 (handler)Core function that executes the ollama.create API call to create a new model with the specified options 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/schemas.ts:164-175 (schema)Zod input validation schema for the ollama_create tool parameters./** * Schema for ollama_create tool */ 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'), });
- src/tools/create.ts:35-84 (registration)Tool definition export that registers the ollama_create tool with the autoloader, including MCP-compatible input schema and handler reference.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 ); }, };