Skip to main content
Glama
push.test.ts1.1 kB
import { describe, it, expect, beforeEach, vi } from 'vitest'; import { Ollama } from 'ollama'; import { pushModel, toolDefinition } from '../../src/tools/push.js'; import { ResponseFormat } from '../../src/types.js'; describe('pushModel', () => { let ollama: Ollama; let mockPush: ReturnType<typeof vi.fn>; beforeEach(() => { mockPush = vi.fn(); ollama = { push: mockPush, } as any; }); it('should push a model to registry', async () => { mockPush.mockResolvedValue({ status: 'success', }); const result = await pushModel( ollama, 'my-model:latest', false, ResponseFormat.JSON ); expect(typeof result).toBe('string'); expect(mockPush).toHaveBeenCalledWith({ model: 'my-model:latest', insecure: false, stream: false, }); }); it('should work through toolDefinition handler', async () => { const result = await toolDefinition.handler( ollama, { model: 'my-model:latest', format: 'json' }, ResponseFormat.JSON ); expect(typeof result).toBe('string'); }); });

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