Skip to main content
Glama
hyzhak
by hyzhak

cp

Transfer AI models between locations within the Ollama MCP Server to manage and organize local LLM resources efficiently using source and destination paths.

Instructions

Copy a model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destinationYes
sourceYes

Implementation Reference

  • The handler function for the 'cp' tool. It takes source and destination model names, calls ollama.copy, and returns the result as JSON or an error message.
    async ({ source, destination }) => { try { const result = await ollama.copy({ source, destination }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${formatError(error)}` }], isError: true }; } }
  • The tool specification including title, description, and inputSchema for 'cp' tool, defining source and destination as strings using Zod.
    title: "Copy model", description: "Copy a model", inputSchema: { source: z.string(), destination: z.string() }, },
  • src/index.ts:119-134 (registration)
    The registration of the 'cp' tool using server.registerTool, including schema and handler.
    server.registerTool( "cp", { title: "Copy model", description: "Copy a model", inputSchema: { source: z.string(), destination: z.string() }, }, async ({ source, destination }) => { try { const result = await ollama.copy({ source, destination }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${formatError(error)}` }], isError: true }; } } );
  • Helper function formatError used in the 'cp' handler and other tools to format errors.
    const formatError = (error: unknown): string => error instanceof Error ? error.message : String(error);

Other Tools

Related Tools

  • @hyzhak/ollama-mcp-server
  • @hyzhak/ollama-mcp-server
  • @hyzhak/ollama-mcp-server
  • @hyzhak/ollama-mcp-server
  • @emgeee/mcp-ollama
  • @hyzhak/ollama-mcp-server

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

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