Skip to main content
Glama

getCurrentTime

Retrieve and format the current time for any locale or time zone using Intl.DateTimeFormat.

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 async handler function for the getCurrentTime tool. It formats the current time using Intl.DateTimeFormat with provided locale and timeZone parameters.
    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 systemTools (containing getCurrentTime) into the allTools object used by the MCP server for tool listing and execution.
    const allTools: ToolKit = { ...systemTools, ...networkTools, ...geoTools, ...generatorTools, ...dateTimeTools, ...securityTools };
  • src/index.ts:5-5 (registration)
    Import of systemTools which includes the getCurrentTime tool definition.
    import { systemTools } from './tools/system.js';

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