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
| Name | Required | Description | Default |
|---|---|---|---|
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}` }] }; } );
- src/server.ts:34-42 (handler)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}` }] }; }
- src/timezone-utils.ts:66-74 (helper)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 } }