Skip to main content
Glama
NightTrek

Ollama MCP Server

by NightTrek

push

Upload a model to a registry for sharing or deployment. Specify the model name to transfer it from local storage to a remote repository.

Instructions

Push a model to a registry

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the model to push

Implementation Reference

  • The main handler function for the 'push' tool. It executes the 'ollama push' command with the provided model name and returns the output or throws an error.
    private async handlePush(args: any) {
      try {
        const { stdout, stderr } = await execAsync(`ollama push ${args.name}`);
        return {
          content: [
            {
              type: 'text',
              text: stdout || stderr,
            },
          ],
        };
      } catch (error) {
        throw new McpError(ErrorCode.InternalError, `Failed to push model: ${formatError(error)}`);
      }
    }
  • The tool definition including input schema for the 'push' tool, registered in the ListTools response. Requires a 'name' string parameter.
    {
      name: 'push',
      description: 'Push a model to a registry',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Name of the model to push',
          },
        },
        required: ['name'],
        additionalProperties: false,
      },
  • src/index.ts:266-267 (registration)
    The switch case registration/dispatch in the CallToolRequestHandler that routes 'push' tool calls to the handlePush function.
    case 'push':
      return await this.handlePush(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