ollama_create
Create custom AI models by specifying base models, system prompts, and templates to tailor model behavior for specific use cases.
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 handler function that executes the ollama.create API call to create a new model.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:167-174 (schema)Zod schema used to validate and parse the input arguments for the 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 object that registers the 'ollama_create' tool with the MCP server via autoloader discovery.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 ); }, };