UNPKG

mcp-wtit

Version:

A Model Context Protocol (MCP) server that provides current time in ISO8601 format with timezone support

32 lines 979 B
import { TimeServiceError } from '../../shared/errors/time.errors.js'; export class GetCurrentTimeUseCase { timeService; constructor(timeService) { this.timeService = timeService; } async execute(input) { try { const timeData = this.timeService.getCurrentTime({ includeMilliseconds: input?.includeMilliseconds, timezone: input?.timezone, }); return { success: true, data: timeData, }; } catch (error) { if (error instanceof TimeServiceError) { return { success: false, error: error.message, }; } return { success: false, error: 'An unexpected error occurred while retrieving the current time', }; } } } //# sourceMappingURL=get-current-time.usecase.js.map