Skip to main content
Glama

get_current_date_time_iso

Retrieve the current date and time in ISO 8601 format for standardized timestamping and timezone-aware applications.

Instructions

Get ISO 8601 time. (e.g. 2025-05-07T23:03:27+09:00)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timezoneNo

Implementation Reference

  • The asynchronous handler function that executes the tool logic: gets current datetime in ISO 8601 format using dayjs library, applies optional timezone via getTZ helper, and returns it as text content.
    async ({ timezone }) => { const currentDateTime = dayjs().tz(getTZ(timezone)).format(); return { content: [ { type: "text", text: currentDateTime, }, ], }; },
  • Input schema definition using Zod: 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, specifying name, description, input schema, and handler function.
    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, }, ], }; }, );
  • Helper function to determine timezone: uses provided value or guesses via dayjs.tz.guess() if omitted.
    const getTZ = (timezon?: string) => { return timezon || dayjs.tz.guess(); };

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/t-shiratori/time-tools-mcp-server'

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