Skip to main content
Glama

MCP-WTIT

by yorifuji
get-current-time.usecase.tsโ€ข1.09 kB
import type { IGetCurrentTimeUseCase, IGetCurrentTimeUseCaseInput, IGetCurrentTimeUseCaseOutput } from '../interfaces/get-current-time.usecase.interface.js'; import type { ITimeService } from '../../domain/interfaces/time.service.interface.js'; import { TimeServiceError } from '../../shared/errors/time.errors.js'; export class GetCurrentTimeUseCase implements IGetCurrentTimeUseCase { constructor(private readonly timeService: ITimeService) {} async execute(input?: IGetCurrentTimeUseCaseInput): Promise<IGetCurrentTimeUseCaseOutput> { 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', }; } } }

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/yorifuji/mcp-wtit'

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