Skip to main content
Glama
t-shiratori

Time Tools MCP Server

convert_datetime_to_unix

Convert human-readable datetime strings to Unix timestamps for time calculations and system compatibility.

Instructions

Convert datetime time to unixtime (e.g. 2025-01-01 01:01:01 to 1746627290)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeYes
timezoneNo

Implementation Reference

  • Handler function that takes a datetime string and optional timezone, parses it with dayjs, applies the timezone, and returns the Unix timestamp in milliseconds using valueOf().
        async ({ time, timezone }) => {
            const unixtime = dayjs(time).tz(getTZ(timezone)).valueOf();
            return {
                content: [
                    {
                        type: "text",
                        text: String(unixtime),
                    },
                ],
            };
        },
    );
  • Zod input schema defining 'time' as required string and 'timezone' as optional string.
    {
        time: z.string(),
        timezone: z.string().optional(),
    },
  • src/index.ts:71-89 (registration)
    Registration of the 'convert_datetime_to_unix' tool using server.tool(), including name, description, schema, and inline handler.
    server.tool(
        "convert_datetime_to_unix",
        "Convert datetime time to unixtime (e.g. 2025-01-01 01:01:01 to 1746627290)",
        {
            time: z.string(),
            timezone: z.string().optional(),
        },
        async ({ time, timezone }) => {
            const unixtime = dayjs(time).tz(getTZ(timezone)).valueOf();
            return {
                content: [
                    {
                        type: "text",
                        text: String(unixtime),
                    },
                ],
            };
        },
    );
  • Helper function 'getTZ' that returns the provided timezone or guesses the local timezone using dayjs.tz.guess().
    const getTZ = (timezon?: string) => {
        return timezon || dayjs.tz.guess();
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the conversion action with an example but does not cover important traits like error handling (e.g., invalid datetime formats), timezone handling implications, or output format details. This leaves significant gaps in understanding the tool's behavior.

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?

The description is extremely concise and front-loaded, consisting of a single sentence with a clear example. Every word serves a purpose, making it efficient and easy to parse without any wasted information.

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

Completeness2/5

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

Given the tool's complexity (a conversion function with 2 parameters), lack of annotations, and no output schema, the description is incomplete. It fails to explain key aspects such as the return value format, error conditions, or how the 'timezone' parameter affects the conversion, leaving the agent with insufficient context for reliable use.

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

Parameters2/5

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

The input schema has 0% description coverage, so the description must compensate. It mentions 'datetime time' and provides an example format, which adds some meaning for the 'time' parameter. However, it does not address the 'timezone' parameter at all, leaving it undocumented. This partial coverage is insufficient for the schema's needs.

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 the tool's purpose: converting datetime to unixtime with an example. It specifies the verb 'convert' and the resource 'datetime time to unixtime', making the function unambiguous. However, it does not explicitly differentiate from sibling tools like 'convert_unix_to_datetime' or 'get_unixtime', which prevents a score of 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It lacks context such as when this conversion is needed, prerequisites, or comparisons to sibling tools like 'convert_unix_to_datetime' or 'get_unixtime'. This absence of usage instructions leaves the agent without clear direction.

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/t-shiratori/time-tools-mcp-server'

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