Skip to main content
Glama
RhombusSystems

Rhombus MCP Server

Official

time-tool

Convert natural language time descriptions (e.g., '2pm today') into precise time values. Optionally specify a timezone for accurate results.

Instructions

This tool is capable of returning the time from a natural language query. If the user asks about the 'current time' use this tool. Try to kee time_description as close to the users initial query as possible. For example if someone says 'was X person seen today?' then time_description should be 'today'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
time_descriptionYesA natural language description of the time (e.g., '2pm today', 'tomorrow at noon').
timezoneYesOptional IANA timezone string (e.g., 'America/Los_Angeles', 'UTC'). Will default to system timezone if not provided.

Implementation Reference

  • The main handler function for the time-tool that receives time_description and timezone args, calls parseTimeDescription, and returns the result as JSON text content.
    const TOOL_HANDLER = async (args: ToolArgs, extra: any) => {
      const { time_description, timezone } = args;
      const result = parseTimeDescription(time_description ?? undefined, timezone ?? undefined, extra);
    
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(result),
          },
        ],
      };
    };
  • Zod schema definitions for the time-tool arguments: time_description (string) and timezone (nullable string). Exports ToolArgs type.
    import { z } from "zod";
    
    export const TOOL_ARGS = {
      time_description: z
        .string()
        .describe(
          "A natural language description of the time (e.g., '2pm today', 'tomorrow at noon')."
        ),
      timezone: z
        .string()
        .nullable()
        .describe(
          "Optional IANA timezone string (e.g., 'America/Los_Angeles', 'UTC'). Will default to system timezone if not provided."
        ),
    };
    
    const TOOL_ARGS_SCHEMA = z.object(TOOL_ARGS);
    export type ToolArgs = z.infer<typeof TOOL_ARGS_SCHEMA>;
  • Registers the time-tool on the MCP server using server.tool() with the tool name, description, args schema, and handler.
    export function createTool(server: McpServer) {
      server.tool(TOOL_NAME, TOOL_DESCRIPTION, TOOL_ARGS, TOOL_HANDLER);
    }
  • The parseTimeDescription API function that normalizes the time description using normalizeTimeDescription, parses it with chrono-node, constructs a Luxon DateTime, and returns timestamp, ISO string, and timezone.
    export function parseTimeDescription(time_description: string, timezone?: string, extra?: any) {
      logger.info("EXTRA", extra);
    
      const now = new Date(DateTime.now().setZone(timezone || "America/Los_Angeles").toISO({ includeOffset: false })!);
    
      const normalizedDescription = normalizeTimeDescription(time_description);
      logger.info(
        `TIME TOOL ${timezone}: Normalized "${time_description}" to "${normalizedDescription}"`
      );
    
      // Use the timezone-adjusted date as the reference date for chrono-node
      const parsed = parse(normalizedDescription, now);
    
      if (!parsed || parsed.length === 0) {
        throw new Error(`Could not parse time description: ${time_description}`);
      }
    
      logger.info(`TIME TOOLPARSED ${time_description}`, JSON.stringify(parsed));
    
      const dateComponents = parsed[0].start;
      if (!dateComponents) {
        throw new Error("Parsed time has no start component");
      }
    
      const dt = DateTime.fromObject(
        {
          year: nullToUndefined(dateComponents.get("year")),
          month: nullToUndefined(dateComponents.get("month")),
          day: nullToUndefined(dateComponents.get("day")),
          hour: nullToUndefined(dateComponents.get("hour")),
          minute: nullToUndefined(dateComponents.get("minute")),
          second: nullToUndefined(dateComponents.get("second")),
          millisecond: 0,
        },
        {
          zone: timezone || "local",
        }
      );
    
      if (!dt.isValid) {
        throw new Error(`Could not construct valid DateTime: ${dt.invalidReason}`);
      }
    
      const timestamp = dt.toMillis();
    
      return {
        timestamp,
        iso: dt.toISO(),
        timezone: dt.zoneName,
      };
    }
  • The normalizeTimeDescription helper function that converts natural language time phrases (e.g., 'current time', 'today', 'this morning') into standardized strings for chrono-node parsing.
    function normalizeTimeDescription(description: string): string {
      const normalized = description.toLowerCase().trim();
    
      if (normalized.includes("current time")) {
        return "now";
      }
    
      // Handle plain day references as start of day
      if (normalized === "today") {
        return "today at 00:00";
      }
      if (normalized === "yesterday") {
        return "yesterday at 00:00";
      }
      if (normalized === "tomorrow") {
        return "tomorrow at 00:00";
      }
    
      // Handle "this" time periods - always refer to today
      if (normalized === "this morning") {
        // For occupancy/access-control investigations, "this morning" should include
        // all events since local midnight unless a narrower range is explicitly requested.
        return "today at 00:00";
      }
      if (normalized === "this afternoon") {
        return "today at 12:00";
      }
      if (normalized === "this evening") {
        return "today at 18:00";
      }
      if (normalized === "this night" || normalized === "tonight") {
        return "today at 20:00";
      }
    
      if (normalized.includes("start of today") || normalized.includes("beginning of today")) {
        return "today at 00:00";
      }
      if (normalized.includes("start of yesterday") || normalized.includes("beginning of yesterday")) {
        return "yesterday at 00:00";
      }
      if (normalized.includes("start of tomorrow") || normalized.includes("beginning of tomorrow")) {
        return "tomorrow at 00:00";
      }
    
      if (normalized.includes("end of today")) {
        return "today at 23:59:59";
      }
      if (normalized.includes("end of yesterday")) {
        return "yesterday at 23:59:59";
      }
      if (normalized.includes("end of tomorrow")) {
        return "tomorrow at 23:59:59";
      }
    
      return description;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It describes a read-like operation but does not explicitly state it is safe or has side effects. For a simple query tool, this is adequate but not thorough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences plus an example, all highly relevant. No wasted words. The instructions are front-loaded and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity, the description covers what the tool does, when to use it, and how to set parameters. Lacks details on return format, but for a time tool that is often acceptable. Overall sufficient for an agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema provides 100% coverage for both parameters. The description adds valuable context by advising to keep time_description close to the user's query, which helps the agent formulate the parameter correctly.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it returns time from a natural language query, distinguishing it from sibling tools like time-conversion-tool. However, it could be slightly more explicit that it handles both current time queries and time descriptions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear guidance on when to use (e.g., 'if user asks about current time') and how to construct the time_description parameter. Lacks explicit exclusion of alternatives, but the sibling list includes time-conversion-tool which implies different use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/RhombusSystems/rhombus-node-mcp'

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