Skip to main content
Glama
ampcome-mcps

Time MCP Server

by ampcome-mcps

get_timestamp

Convert human-readable date and time strings into Unix timestamps for programming and data processing applications.

Instructions

Get the timestamp for the time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeNoThe time to get the timestamp. Format: YYYY-MM-DD HH:mm:ss

Implementation Reference

  • The core handler function that computes the Unix timestamp (milliseconds) for the given time string (parsed as UTC) or the current time.
    function getTimestamp(time?: string) {
      return time ? dayjs.utc(time).valueOf() : dayjs().valueOf();
    }
  • Defines the Tool object for 'get_timestamp' including name, description, and input schema allowing optional 'time' parameter.
    export const GET_TIMESTAMP: Tool = {
      name: 'get_timestamp',
      description: 'Get the timestamp for the time.',
      inputSchema: {
        type: 'object',
        properties: {
          time: {
            type: 'string',
            description: 'The time to get the timestamp. Format: YYYY-MM-DD HH:mm:ss',
          },
        },
      },
    };
  • src/index.ts:30-34 (registration)
    Registers the GET_TIMESTAMP tool in the list of available tools returned by ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [CURRENT_TIME, RELATIVE_TIME, DAYS_IN_MONTH, GET_TIMESTAMP, CONVERT_TIME, GET_WEEK_YEAR],
      };
    });
  • Dispatches the get_timestamp tool call: validates arguments, invokes getTimestamp handler, and formats the response content.
    case 'get_timestamp': {
      if (!checkTimestampArgs(args)) {
        throw new Error(`Invalid arguments for tool: [${name}]`);
      }
      const time = args.time;
      const result = getTimestamp(time);
      return {
        success: true,
        content: [
          {
            type: 'text',
            text: time 
              ? `The timestamp of ${time} (parsed as UTC) is ${result} ms.`
              : `The current timestamp is ${result} ms.`,
          },
        ],
      };
    }
  • Helper function to validate input arguments for the get_timestamp tool.
    function checkTimestampArgs(args: unknown): args is { time?: string } {
      return (
        typeof args === 'object' &&
        args !== null &&
        'time' in args &&
        (typeof args.time === 'string' || args.time === undefined)
      );
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It doesn't specify whether this is a pure function, what errors might occur (e.g., invalid format), what timezone is assumed, or what the output format is. The description mentions 'the timestamp' but doesn't define what that means operationally.

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

Conciseness4/5

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

The description is extremely concise at just 6 words, which could be appropriate for a simple tool. However, this brevity comes at the cost of clarity - it's under-specified rather than efficiently informative. The single sentence is front-loaded but doesn't provide enough substance.

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?

For a tool with no annotations, no output schema, and 1 parameter, the description is incomplete. It doesn't explain what a 'timestamp' output looks like, what transformations occur, or how this differs from sibling tools. The agent lacks sufficient information to understand what this tool actually produces or when to use it.

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

Parameters3/5

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

Schema description coverage is 100%, with the single parameter 'time' documented as 'The time to get the timestamp' with format specification. The description adds no additional parameter semantics beyond what's in the schema. Since schema coverage is complete, the baseline score of 3 applies - adequate but no value added.

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

Purpose2/5

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

The description 'Get the timestamp for the time' is tautological - it essentially restates the tool name 'get_timestamp' without adding meaningful specificity. It doesn't explain what a 'timestamp' means in this context (e.g., Unix timestamp, ISO string, etc.) or what transformation occurs. While it mentions 'the time' as input, it doesn't clarify what the output represents.

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?

No guidance is provided about when to use this tool versus its siblings like 'convert_time' or 'current_time'. The description doesn't indicate whether this is for parsing human-readable times, converting between formats, or generating timestamps from date strings. Without usage context, an agent must infer from the name alone.

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/ampcome-mcps/time-mcp'

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