get_current_time
Retrieve current date and time in Korean Standard Time (KST) with format options including locale, ISO, and timestamp for accurate timekeeping applications.
Instructions
현재 시간을 알려주는 도구입니다. 한국 시간(KST)으로 현재 날짜와 시간을 반환합니다.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | 시간 포맷 (기본값: locale) |
Implementation Reference
- src/index.ts:65-73 (handler)The async handler function for the get_current_time tool. It receives the format parameter, calls the getCurrentTime helper, and returns a structured response containing the current time as text.async ({ format = "locale" }) => { const currentTime = getCurrentTime(format); return { content: [{ type: "text", text: `현재 시간: ${currentTime}` }] }; }
- src/index.ts:58-64 (schema)The input schema and metadata for the get_current_time tool, defining the optional 'format' parameter as an enum of time formats.{ title: "현재 시간 조회", description: "현재 시간을 알려주는 도구입니다. 한국 시간(KST)으로 현재 날짜와 시간을 반환합니다.", inputSchema: { format: z.enum(["locale", "iso", "timestamp"]).optional().describe("시간 포맷 (기본값: locale)") } },
- src/index.ts:56-74 (registration)The registration of the get_current_time tool using server.registerTool, including name, schema, and handler.server.registerTool( "get_current_time", { title: "현재 시간 조회", description: "현재 시간을 알려주는 도구입니다. 한국 시간(KST)으로 현재 날짜와 시간을 반환합니다.", inputSchema: { format: z.enum(["locale", "iso", "timestamp"]).optional().describe("시간 포맷 (기본값: locale)") } }, async ({ format = "locale" }) => { const currentTime = getCurrentTime(format); return { content: [{ type: "text", text: `현재 시간: ${currentTime}` }] }; } );
- src/index.ts:12-33 (helper)The helper function getCurrentTime that computes the current time (KST) in the specified format: 'locale' (Korean formatted), 'iso' (ISO-like), or 'timestamp' (Unix timestamp).function getCurrentTime(format: string = "locale"): string { const now = new Date(); switch (format) { case "iso": return now.toLocaleString("sv-SE", { timeZone: "Asia/Seoul" }).replace(" ", "T") + ".000Z"; case "timestamp": return now.getTime().toString(); case "locale": default: return now.toLocaleString("ko-KR", { timeZone: "Asia/Seoul", year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", weekday: "long" }); } }