Skip to main content
Glama

getCurrentTime

Retrieve and format the current time in any locale and time zone using Intl.DateTimeFormat. Specify locale and time zone for accurate, localized time data.

Instructions

Get current time formatted with Intl.DateTimeFormat

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
localeNoLocale for formatting (e.g., en-US)en-US
timeZoneNoTime zone (e.g., America/New_York)UTC

Implementation Reference

  • The handler function for the getCurrentTime tool, which formats the current time using Intl.DateTimeFormat with specified locale and timeZone.
    handler: async ({ locale = 'en-US', timeZone = 'UTC' }) => { const formatter = new Intl.DateTimeFormat(locale, { timeZone, year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', timeZoneName: 'short' }); return { content: [{ type: 'text', text: formatter.format(Date.now()) }] }; }
  • Input schema for the getCurrentTime tool, defining optional locale and timeZone parameters.
    inputSchema: { type: 'object', properties: { locale: { type: 'string', description: 'Locale for formatting (e.g., en-US)', default: 'en-US' }, timeZone: { type: 'string', description: 'Time zone (e.g., America/New_York)', default: 'UTC' } } },
  • src/index.ts:28-35 (registration)
    Registration of the getCurrentTime tool by spreading systemTools into the allTools object, which is used by the MCP server's tool listing and execution handlers.
    const allTools: ToolKit = { ...systemTools, ...networkTools, ...geoTools, ...generatorTools, ...dateTimeTools, ...securityTools };

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/cyanheads/toolkit-mcp-server'

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