Skip to main content
Glama

currentDateTime

Retrieve the current date and time for a specified timezone or default to UTC. Input a valid IANA timezone name like 'America/New_York' to get the accurate local time.

Instructions

Get Current Date and time for timezone. if timezone is not passed default to UTC

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timezoneNoThe timezone should be a valid IANA timezone name like "America/New_York" or "Asia/Kolkata"

Implementation Reference

  • Handler function that takes timezone input (optional, defaults to UTC) and returns the current date and time formatted using Intl.DateTimeFormat.
    (data) => { const formatter = new Intl.DateTimeFormat("en-US", { timeZone: data.timezone || "UTC", dateStyle: "full", timeStyle: "long", }); return { content: [{ type: "text", text: formatter.format(new Date()), }] } }
  • Zod schema defining the input parameters for the currentDateTime tool: optional nullable timezone string.
    { timezone: z.string().optional().nullable().describe(`The timezone should be a valid IANA timezone name like "America/New_York" or "Asia/Kolkata"`), },
  • src/server.ts:99-116 (registration)
    Registration of the currentDateTime tool on the MCP server, specifying name, description, input schema, and inline handler function.
    server.tool("currentDateTime", "Get Current Date and time for timezone. if timezone is not passed default to UTC", { timezone: z.string().optional().nullable().describe(`The timezone should be a valid IANA timezone name like "America/New_York" or "Asia/Kolkata"`), }, (data) => { const formatter = new Intl.DateTimeFormat("en-US", { timeZone: data.timezone || "UTC", dateStyle: "full", timeStyle: "long", }); return { content: [{ type: "text", text: formatter.format(new Date()), }] } } );

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/mailmodo/mailmodo-mcp'

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