Skip to main content
Glama
paladini

devutils-mcp-server

timestamp_to_date

Convert Unix timestamps (seconds or milliseconds) to human-readable ISO 8601 date strings with timezone support.

Instructions

Convert a Unix timestamp (seconds or milliseconds) to a human-readable ISO 8601 date string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timestampYesUnix timestamp (seconds or milliseconds)
timezoneNoIANA timezone (e.g., 'America/New_York', 'Europe/London', default: UTC)UTC

Implementation Reference

  • The asynchronous handler function that processes the Unix timestamp input, performs the conversion, and formats the output.
    async ({ timestamp, timezone }) => {
      try {
        // Auto-detect seconds vs milliseconds
        const ms = timestamp > 1e12 ? timestamp : timestamp * 1000;
        const date = new Date(ms);
    
        if (isNaN(date.getTime())) {
          return {
            content: [
              { type: "text" as const, text: "Error: Invalid timestamp" },
            ],
            isError: true,
          };
        }
    
        const result = {
          iso: date.toISOString(),
          utc: date.toUTCString(),
          local: date.toLocaleString("en-US", { timeZone: timezone }),
          timezone,
          unix_seconds: Math.floor(ms / 1000),
          unix_milliseconds: ms,
        };
    
        return {
          content: [
            { type: "text" as const, text: JSON.stringify(result, null, 2) },
          ],
        };
      } catch (e) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error: ${e instanceof Error ? e.message : String(e)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining the input parameters for the 'timestamp_to_date' tool.
    {
      timestamp: z.number().describe("Unix timestamp (seconds or milliseconds)"),
      timezone: z
        .string()
        .default("UTC")
        .describe("IANA timezone (e.g., 'America/New_York', 'Europe/London', default: UTC)"),
    },
  • The registration of the 'timestamp_to_date' tool within the MCP server using server.tool.
    server.tool(
      "timestamp_to_date",
      "Convert a Unix timestamp (seconds or milliseconds) to a human-readable ISO 8601 date string.",
      {
        timestamp: z.number().describe("Unix timestamp (seconds or milliseconds)"),
        timezone: z
          .string()
          .default("UTC")
          .describe("IANA timezone (e.g., 'America/New_York', 'Europe/London', default: UTC)"),
      },
Behavior4/5

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

Without annotations, the description carries full disclosure burden. It successfully reveals key behavioral traits: automatic handling of both seconds and milliseconds input units, and ISO 8601 string output format. Missing only edge-case behavior (invalid timestamps, out-of-range values).

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?

Single sentence, front-loaded with action verb. Every word earns its place: specifies input variant (Unix), input format (seconds/milliseconds), and output format (ISO 8601). Zero redundancy or waste.

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?

Appropriate for a simple 2-parameter utility tool with no nested objects. Description compensates for missing output schema by specifying ISO 8601 return format. 100% parameter coverage means no semantic gaps remain.

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 has 100% description coverage (baseline 3). Description adds value beyond schema by clarifying that timestamp parameter accepts 'seconds or milliseconds' (unit flexibility), which is critical semantic information not explicitly stated in the schema property description.

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

Purpose5/5

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

Description states specific verb (Convert) + resource (Unix timestamp) + output format (human-readable ISO 8601 date string). It implicitly distinguishes from sibling date_to_timestamp by specifying the direction (timestamp to date) and clarifies it accepts both seconds and milliseconds.

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

Usage Guidelines3/5

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

Description clearly implies when to use (when converting timestamps to dates) but lacks explicit guidance on when NOT to use or references to sibling date_to_timestamp as the alternative for reverse conversion. Usage is implied rather than explicitly guided.

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/paladini/devutils-mcp-server'

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