Skip to main content
Glama
NightTrek

Ollama MCP Server

by NightTrek

cp

Copy Ollama AI models locally to create duplicates or backups of existing models for different uses or testing.

Instructions

Copy a model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesSource model name
destinationYesDestination model name

Implementation Reference

  • The handler function for the 'cp' tool. It executes the 'ollama cp' command with source and destination arguments, captures stdout/stderr, and returns it as text content. Errors are wrapped in McpError.
    private async handleCopy(args: any) { try { const { stdout, stderr } = await execAsync(`ollama cp ${args.source} ${args.destination}`); return { content: [ { type: 'text', text: stdout || stderr, }, ], }; } catch (error) { throw new McpError(ErrorCode.InternalError, `Failed to copy model: ${formatError(error)}`); } }
  • Input schema for the 'cp' tool defining required 'source' and 'destination' string properties.
    inputSchema: { type: 'object', properties: { source: { type: 'string', description: 'Source model name', }, destination: { type: 'string', description: 'Destination model name', }, }, required: ['source', 'destination'], additionalProperties: false, },
  • src/index.ts:173-191 (registration)
    Tool registration object for 'cp' in the setTools call, including name, description, and inputSchema.
    { name: 'cp', description: 'Copy a model', inputSchema: { type: 'object', properties: { source: { type: 'string', description: 'Source model name', }, destination: { type: 'string', description: 'Destination model name', }, }, required: ['source', 'destination'], additionalProperties: false, }, },
  • src/index.ts:270-271 (registration)
    Dispatcher case in the request handler that routes 'cp' tool calls to handleCopy function.
    case 'cp': return await this.handleCopy(request.params.arguments);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/NightTrek/Ollama-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server