Skip to main content
Glama
ciel240
by ciel240

current_time

Get the current time in any timezone. Defaults to Korean time (Asia/Seoul) when no timezone is specified.

Instructions

현재 시간을 지정된 시간대에서 조회하는 도구. 시간대를 입력하지 않으면 한국 시간대(Asia/Seoul)를 사용합니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timezoneNo시간대 (예: Asia/Seoul, America/New_York, Europe/London). 입력하지 않으면 한국 시간대를 사용합니다.

Implementation Reference

  • MCP CallToolRequest handler for 'current_time': parses arguments using TimeToolSchema, calls getCurrentTime, and returns the formatted time as text content.
    if (request.params.name === 'current_time') {
        try {
            const { timezone } = TimeToolSchema.parse(request.params.arguments)
            
            const currentTime = getCurrentTime(timezone)
            const message = `현재 시간: ${currentTime}`
            
            return {
                content: [
                    {
                        type: 'text',
                        text: message
                    }
                ]
            }
        } catch (error) {
            return {
                content: [
                    {
                        type: 'text',
                        text: `시간 조회 오류: ${error instanceof Error ? error.message : '알 수 없는 오류'}`
                    }
                ],
                isError: true
            }
        }
    }
  • Zod schema defining the input for current_time tool: optional timezone string.
    const TimeToolSchema = z.object({
        timezone: z.string().optional().describe('시간대 (예: Asia/Seoul, America/New_York, Europe/London). 입력하지 않으면 한국 시간대(Asia/Seoul)를 사용합니다.')
    })
  • src/index.ts:357-370 (registration)
    Tool registration in ListToolsRequest handler: defines 'current_time' tool with description and inputSchema matching TimeToolSchema.
    {
        name: 'current_time',
        description: '현재 시간을 지정된 시간대에서 조회하는 도구. 시간대를 입력하지 않으면 한국 시간대(Asia/Seoul)를 사용합니다.',
        inputSchema: {
            type: 'object',
            properties: {
                timezone: {
                    type: 'string',
                    description: '시간대 (예: Asia/Seoul, America/New_York, Europe/London). 입력하지 않으면 한국 시간대를 사용합니다.'
                }
            },
            required: []
        }
    },
  • Helper function that formats and returns the current time in the specified timezone using Intl.DateTimeFormat, defaults to 'Asia/Seoul'.
    const getCurrentTime = (timezone: string = 'Asia/Seoul'): string => {
        try {
            const now = new Date()
            const options: Intl.DateTimeFormatOptions = {
                timeZone: timezone,
                year: 'numeric',
                month: '2-digit',
                day: '2-digit',
                hour: '2-digit',
                minute: '2-digit',
                second: '2-digit',
                hour12: false
            }
            
            const formatter = new Intl.DateTimeFormat('ko-KR', options)
            const timeString = formatter.format(now)
            
            return `${timeString} (${timezone})`
        } catch (error) {
            throw new Error(`유효하지 않은 시간대입니다: ${timezone}`)
        }
    }

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/ciel240/class_study'

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