get_current_time
Retrieve the current date and time in your local timezone using system detection.
Instructions
Get the current date and time in your local timezone
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_current_time"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:143-181 (handler)The switch case that handles the 'get_current_time' tool call. It formats the current date and time using the detected timezone, provides fallback formatting, and returns a JSON object with local time, timezone, ISO time, Unix timestamp, and UTC offset.
case 'get_current_time': { const now = new Date(); let localTime; try { localTime = new Intl.DateTimeFormat('en-US', { timeZone: TIMEZONE, year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false, weekday: 'long', timeZoneName: 'long' }).format(now); } catch (e) { // Fallback if timezone is invalid localTime = now.toString(); } const isoString = now.toISOString(); return { content: [ { type: 'text', text: JSON.stringify({ current_time: localTime, timezone: TIMEZONE, iso_time: isoString, unix_timestamp: Math.floor(now.getTime() / 1000), utc_offset: new Date().getTimezoneOffset() }, null, 2), }, ], }; } - server.js:118-125 (registration)Registration of the 'get_current_time' tool in the ListTools response, specifying the name, description, and empty input schema.
{ name: 'get_current_time', description: 'Get the current date and time in your local timezone', inputSchema: { type: 'object', properties: {}, }, }, - server.js:121-124 (schema)Input schema definition for the 'get_current_time' tool, indicating no input parameters are required.
inputSchema: { type: 'object', properties: {}, },