Skip to main content
Glama
SergeSerb2

Time & Location MCP Server

by SergeSerb2

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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: {}, }, },
  • Input schema definition for the 'get_current_time' tool, indicating no input parameters are required.
    inputSchema: { type: 'object', properties: {}, },

Other Tools

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/SergeSerb2/time_mcp'

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