Skip to main content
Glama
rawveg

Ollama MCP Server

ollama_copy

Copy a model to create a duplicate with a new name, enabling model backup or version creation.

Instructions

Copy a model. Creates a duplicate of an existing model with a new name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesName of the source model
destinationYesName for the copied model
formatNojson

Implementation Reference

  • The core handler function for ollama_copy. Calls ollama.copy() with source and destination, then formats the response.
    export async function copyModel(
      ollama: Ollama,
      source: string,
      destination: string,
      format: ResponseFormat
    ): Promise<string> {
      const response = await ollama.copy({
        source,
        destination,
      });
    
      return formatResponse(JSON.stringify(response), format);
    }
  • The ToolDefinition export that registers 'ollama_copy' with its name, description, input schema, and a handler that validates args with CopyModelInputSchema before calling copyModel.
    export const toolDefinition: ToolDefinition = {
      name: 'ollama_copy',
      description:
        'Copy a model. Creates a duplicate of an existing model with a new name.',
      inputSchema: {
        type: 'object',
        properties: {
          source: {
            type: 'string',
            description: 'Name of the source model',
          },
          destination: {
            type: 'string',
            description: 'Name for the copied model',
          },
          format: {
            type: 'string',
            enum: ['json', 'markdown'],
            default: 'json',
          },
        },
        required: ['source', 'destination'],
      },
      handler: async (ollama: Ollama, args: Record<string, unknown>, format: ResponseFormat) => {
        const validated = CopyModelInputSchema.parse(args);
        return copyModel(ollama, validated.source, validated.destination, format);
      },
    };
  • Zod schema for ollama_copy input validation: requires source (string), destination (string), and optional format (default 'json').
    /**
     * Schema for ollama_copy tool
     */
    export const CopyModelInputSchema = z.object({
      source: z.string().min(1),
      destination: z.string().min(1),
      format: ResponseFormatSchema.default('json'),
    });
  • The formatResponse function used by copyModel to format the Ollama API response as JSON or markdown.
    export function formatResponse(
      content: string,
      format: ResponseFormat
    ): string {
  • The discoverTools function that auto-discovers all tool definitions (including ollama_copy) from the tools directory by dynamic import.
    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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It only states the action without explaining side effects (e.g., disk usage, permissions required, whether the original is affected) or any constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Very concise at one sentence, front-loading the action. However, it could include a brief note on output or usage without becoming verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, so the description should explain return values (e.g., success confirmation). It also lacks behavioral details to help an agent decide between sibling tools, given the simple task.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 67% (source and destination have basic descriptions, format lacks description). The tool description adds no additional meaning beyond the schema, and the format parameter is not explained despite having enum options.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action: 'Copy a model' and specifies the resource (model) and result ('duplicate with new name'). This distinguishes it from siblings like ollama_create or ollama_delete.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like ollama_create or ollama_pull. The description does not mention scenarios, prerequisites, or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/rawveg/ollama-mcp'

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