get_current_date_time_iso
Retrieve the current date and time in ISO 8601 format, with an optional timezone parameter, using the 'Time Tools MCP Server' for accurate time manipulation tasks.
Instructions
Get ISO 8601 time. (e.g. 2025-05-07T23:03:27+09:00)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timezone | No |
Implementation Reference
- src/index.ts:118-128 (handler)The handler function for the 'get_current_date_time_iso' tool. It computes the current date and time in ISO 8601 format using dayjs in the specified (or default) timezone.async ({ timezone }) => { const currentDateTime = dayjs().tz(getTZ(timezone)).format(); return { content: [ { type: "text", text: currentDateTime, }, ], }; },
- src/index.ts:115-117 (schema)Input schema for the tool, defining an optional 'timezone' string parameter.{ timezone: z.string().optional(), },
- src/index.ts:112-129 (registration)Registration of the 'get_current_date_time_iso' tool on the MCP server using server.tool().server.tool( "get_current_date_time_iso", "Get ISO 8601 time. (e.g. 2025-05-07T23:03:27+09:00)", { timezone: z.string().optional(), }, async ({ timezone }) => { const currentDateTime = dayjs().tz(getTZ(timezone)).format(); return { content: [ { type: "text", text: currentDateTime, }, ], }; }, );
- src/index.ts:13-15 (helper)Helper function 'getTZ' used by the tool handler to determine the timezone, defaulting to the guessed timezone if not provided.const getTZ = (timezon?: string) => { return timezon || dayjs.tz.guess(); };