get_system_timezone
Retrieve the current system timezone for accurate, timezone-aware date and time operations, resolving inconsistencies caused by timezone mismatches.
Instructions
Get the system's current timezone
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:151-168 (handler)MCP server request handler for the 'get_system_timezone' tool. Retrieves the system timezone using TimeService and enriches with current time info in the system timezone.case 'get_system_timezone': { const systemTimezone = TimeService.getSystemTimezone(); const currentTime = TimeService.getCurrentTime(systemTimezone, 'full'); return { content: [ { type: 'text', text: JSON.stringify({ systemTimezone, currentTime: currentTime.localizedFormat, utcOffset: currentTime.utcOffset, isDST: currentTime.isDST, }, null, 2), }, ], }; }
- src/index.ts:72-79 (registration)Tool registration in the list of available tools for the MCP server, including name, description, and empty input schema.{ name: 'get_system_timezone', description: 'Get the system\'s current timezone', inputSchema: { type: 'object', properties: {}, }, },
- src/time-service.ts:25-27 (helper)Core helper function in TimeService that implements the logic to get the system's current timezone using JavaScript's Intl API.static getSystemTimezone(): string { return Intl.DateTimeFormat().resolvedOptions().timeZone; }