Skip to main content
Glama
arjshiv

Local Utilities MCP Server

by arjshiv

get_time_and_date

Retrieve current time, date, day of week, and timestamp in multiple formats for system integration and time-sensitive operations.

Instructions

Returns the current time, date, day of week, and timestamp in various formats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that retrieves and formats the current time, date, day of week, ISO timestamp, and Unix timestamp.
    export function getCurrentTimeAndDate(): ITimeResponse {
      const now = new Date();
      const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
      
      return {
        time: now.toLocaleTimeString(),
        date: now.toLocaleDateString(),
        dayOfWeek: days[now.getDay()],
        iso: now.toISOString(),
        timestamp: now.getTime(),
      };
    }
  • TypeScript interface defining the shape of the time and date response object.
    interface ITimeResponse {
      time: string;
      date: string;
      dayOfWeek: string;
      iso: string;
      timestamp: number;
    }
  • src/mcp/time.ts:25-37 (registration)
    Registers the 'get_time_and_date' tool with the MCP server, including description and execution handler.
    server.tool(
      "get_time_and_date",
      "Returns the current time, date, day of week, and timestamp in various formats",
      async () => {
        const result = getCurrentTimeAndDate();
        return {
          content: [{
            type: "text",
            text: JSON.stringify(result, null, 2)
          }]
        };
      }
    );
  • src/index.ts:24-24 (registration)
    Calls the module registration function to add the time tool to the main MCP server instance.
    registerTimeTool(server);
  • src/index.ts:9-9 (registration)
    Imports the registration function for the time tool.
    import { registerTimeTool } from "./mcp/time.js";

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/arjshiv/localutils-mcp-server'

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