Skip to main content
Glama
odgrim
by odgrim

get-current-timezone

Retrieve the current system timezone to enable accurate datetime handling for AI agents and chat interfaces.

Instructions

Get the current system timezone

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/server.ts:31-43 (registration)
    Registers the 'get-current-timezone' tool with the MCP server, including inline handler function that retrieves and returns the current system timezone.
    server.tool( "get-current-timezone", "Get the current system timezone", async () => { const timezone = getCurrentTimezone(); return { content: [{ type: "text", text: `The current system timezone is ${timezone}` }] }; } );
  • Inline handler function for the tool that calls getCurrentTimezone() and formats the response as text content.
    async () => { const timezone = getCurrentTimezone(); return { content: [{ type: "text", text: `The current system timezone is ${timezone}` }] }; }
  • Core helper function that implements the logic to get the current system timezone using Intl.DateTimeFormat().resolvedOptions().timeZone, with fallback to UTC.
    export function getCurrentTimezone(): string { try { const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; return processTimezone(timezone); } catch (error) { console.error("Error getting current timezone:", error); return "UTC"; // Default to UTC if there's an error } }

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/odgrim/mcp-datetime'

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