Skip to main content
Glama
Atomic-Germ

MCP Ollama Consult Server

BaseHandler.test.ts1.28 kB
import { describe, it, expect } from 'vitest'; import { BaseHandler } from '../../src/handlers/BaseHandler'; import { ValidationError } from '../../src/types'; class TestHandler extends BaseHandler { async handle(params: any): Promise<any> { this.validateRequired(params, ['model', 'prompt']); return { success: true }; } } describe('BaseHandler', () => { it('should validate required fields', async () => { const handler = new TestHandler(); await expect(handler.handle({ model: 'test' })).rejects.toThrow(ValidationError); await expect(handler.handle({ prompt: 'test' })).rejects.toThrow(ValidationError); }); it('should pass validation with all required fields', async () => { const handler = new TestHandler(); const result = await handler.handle({ model: 'test', prompt: 'test' }); expect(result).toEqual({ success: true }); }); it('should handle errors consistently', async () => { class ErrorHandler extends BaseHandler { async handle(): Promise<any> { try { throw new Error('Test error'); } catch (error) { this.handleError(error); } } } const handler = new ErrorHandler(); await expect(handler.handle({})).rejects.toThrow('Test error'); }); });

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/Atomic-Germ/mcp-consult'

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