Skip to main content
Glama
yorifuji

MCP-WTIT

by yorifuji

get_current_time

Retrieve current time with ISO8601 format, timestamp, and timezone details. Specify timezone and include milliseconds for precise time data.

Instructions

Get the current time with detailed information including ISO8601 format, timestamp, and timezone

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeMillisecondsNoInclude milliseconds in the ISO8601 format (default: true)
timezoneNoTimezone for the time (default: UTC). Examples: "UTC", "America/New_York", "Asia/Tokyo"UTC

Implementation Reference

  • Direct handler for the 'get_current_time' tool call within the MCP server, invokes the use case and formats the MCP CallToolResult.
    private async handleGetCurrentTime(args: unknown): Promise<CallToolResult> { const input = this.parseTimeArguments(args); const result = await this.dependencies.getCurrentTimeUseCase.execute(input); if (!result.success || !result.data) { return { content: [ { type: 'text', text: `Error: ${result.error || 'Failed to get current time'}`, } as TextContent, ], isError: true, }; } return { content: [ { type: 'text', text: JSON.stringify(result.data, null, 2), } as TextContent, ], }; }
  • Input schema for the 'get_current_time' tool as returned in ListTools.
    type: 'object', properties: { includeMilliseconds: { type: 'boolean', description: 'Include milliseconds in the ISO8601 format (default: true)', default: true, }, timezone: { type: 'string', description: 'Timezone for the time (default: UTC). Examples: "UTC", "America/New_York", "Asia/Tokyo"', default: 'UTC', }, }, },
  • Tool registration in handleListTools method, defines name, description, and schema for 'get_current_time'.
    tools: [ { name: 'get_current_time', description: 'Get the current time with detailed information including ISO8601 format, timestamp, and timezone', inputSchema: { type: 'object', properties: { includeMilliseconds: { type: 'boolean', description: 'Include milliseconds in the ISO8601 format (default: true)', default: true, }, timezone: { type: 'string', description: 'Timezone for the time (default: UTC). Examples: "UTC", "America/New_York", "Asia/Tokyo"', default: 'UTC', }, }, }, } as Tool, ], };
  • Application use case handler invoked by the MCP tool handler, calls the domain time service.
    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', }; } } }
  • Core helper function that computes and returns the current time data (ITimeData).
    getCurrentTime(options?: ITimeFormatOptions): ITimeData { const mergedOptions = { ...this.defaultOptions, ...options }; const now = new Date(); return { iso8601: this.formatToISO8601(now, mergedOptions), timestamp: now.getTime(), timezone: mergedOptions.timezone || this.getTimeZone(), }; }

Other Tools

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