ollama_pull
Downloads a model from the Ollama registry, making it available for local execution.
Instructions
Pull a model from the Ollama registry. Downloads the model to make it available locally.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | Name of the model to pull | |
| insecure | No | Allow insecure connections | |
| format | No | json |
Implementation Reference
- src/tools/pull.ts:10-23 (handler)Core handler function that calls ollama.pull() to download a model from the Ollama registry.
export async function pullModel( ollama: Ollama, model: string, insecure: boolean, format: ResponseFormat ): Promise<string> { const response = await ollama.pull({ model, insecure, stream: false, }); return formatResponse(JSON.stringify(response), format); } - src/tools/pull.ts:49-52 (handler)Cloud handler function that validates args via PullModelInputSchema and delegates to pullModel().
handler: async (ollama: Ollama, args: Record<string, unknown>, format: ResponseFormat) => { const validated = PullModelInputSchema.parse(args); return pullModel(ollama, validated.model, validated.insecure, format); }, - src/tools/pull.ts:25-52 (registration)Tool definition export (toolDefinition) with name 'ollama_pull', description, inputSchema, and handler. Auto-discovered by autoloader.ts.
export const toolDefinition: ToolDefinition = { name: 'ollama_pull', description: 'Pull a model from the Ollama registry. Downloads the model to make it available locally.', inputSchema: { type: 'object', properties: { model: { type: 'string', description: 'Name of the model to pull', }, insecure: { type: 'boolean', description: 'Allow insecure connections', default: false, }, format: { type: 'string', enum: ['json', 'markdown'], default: 'json', }, }, required: ['model'], }, handler: async (ollama: Ollama, args: Record<string, unknown>, format: ResponseFormat) => { const validated = PullModelInputSchema.parse(args); return pullModel(ollama, validated.model, validated.insecure, format); }, - src/schemas.ts:149-153 (schema)Zod schema (PullModelInputSchema) for ollama_pull validating 'model' (required string), 'insecure' (boolean, default false), and 'format' (enum, default 'json').
export const PullModelInputSchema = z.object({ model: z.string().min(1), insecure: z.boolean().default(false), format: ResponseFormatSchema.default('json'), }); - src/autoloader.ts:31-57 (registration)Auto-loader that discovers all tools (including ollama_pull) by importing each .ts/.js file in src/tools/ and collecting exported toolDefinition objects.
export async function discoverTools(): Promise<ToolDefinition[]> { const toolsDir = join(__dirname, 'tools'); const files = await readdir(toolsDir); // Filter for .js files (production) or .ts files (development) // Exclude test files and declaration files const toolFiles = files.filter( (file) => (file.endsWith('.js') || file.endsWith('.ts')) && !file.includes('.test.') && !file.endsWith('.d.ts') ); const tools: ToolDefinition[] = []; for (const file of toolFiles) { const toolPath = join(toolsDir, file); const module = await import(toolPath); // Check if module exports tool metadata if (module.toolDefinition) { tools.push(module.toolDefinition); } } return tools; }