Skip to main content
Glama
pshempel

MCP Time Server Node

by pshempel
getCurrentTime.integration.test.ts1.68 kB
import { createTestEnvironment } from '../helpers/setup'; import { callTool } from '../helpers/tools'; describe('get_current_time integration', () => { it('should execute get_current_time with default params', async () => { const { client, cleanup } = await createTestEnvironment(); try { const result = await callTool(client, 'get_current_time', {}); // Should use system timezone when no timezone specified expect(result.timezone).toBeDefined(); expect(result.timezone).not.toBe(''); // Should have a valid timezone expect(result.unix).toBeCloseTo(Date.now() / 1000, -1); // Allow 10 second difference expect(result.offset).toMatch(/^([+-]\d{2}:\d{2}|Z)$/); // Valid offset format expect(result.iso).toBeDefined(); expect(result.time).toBeDefined(); } finally { await cleanup(); } }); it('should execute get_current_time with specific timezone', async () => { const { client, cleanup } = await createTestEnvironment(); try { const result = await callTool(client, 'get_current_time', { timezone: 'America/New_York', }); expect(result.timezone).toBe('America/New_York'); expect(result.offset).toMatch(/^[+-]\d{2}:\d{2}$/); } finally { await cleanup(); } }); it('should use UTC when empty string timezone provided', async () => { const { client, cleanup } = await createTestEnvironment(); try { const result = await callTool(client, 'get_current_time', { timezone: '', }); expect(result.timezone).toBe('UTC'); expect(result.offset).toBe('Z'); } finally { await cleanup(); } }); });

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/pshempel/mcp-time-server-node'

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