Skip to main content
Glama

batchGetDateByTimestamp

Convert multiple timestamps to readable dates in batch for efficient data processing.

Instructions

Batch convert the provided list of timestamps to date format, used for processing multiple timestamps

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tsListYes

Implementation Reference

  • index.ts:43-52 (handler)
    Handler that executes the batchGetDateByTimestamp tool by invoking the helper on tsList and formatting the array of date strings as TextContent array for MCP response.
    execute: async (args) => { let result = batchGetDateByTimestamp(args.tsList); let ct: TextContent[] = result.map(item => ({ type: "text", text: item })) return { content: ct, }; },
  • Zod input schema defining tsList as an array of numbers.
    parameters: z.object({ tsList: z.array(z.number()), }),
  • index.ts:37-53 (registration)
    Registers the batchGetDateByTimestamp tool with FastMCP, including name, description, input schema, and handler.
    server.addTool({ name: "batchGetDateByTimestamp", description: "Batch convert the provided list of timestamps to date format, used for processing multiple timestamps", parameters: z.object({ tsList: z.array(z.number()), }), execute: async (args) => { let result = batchGetDateByTimestamp(args.tsList); let ct: TextContent[] = result.map(item => ({ type: "text", text: item })) return { content: ct, }; }, });
  • Helper function implementing the core logic: maps each timestamp to a date string using getDateByTimestamp helper.
    function batchGetDateByTimestamp(tsList: number[]) { return tsList.map(timestamp => getDateByTimestamp(timestamp)); }
  • Supporting helper function that converts a single timestamp to a locale-formatted date string, used by batchGetDateByTimestamp.
    function getDateByTimestamp(ts: number) { return new Date(ts).toLocaleString() }

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/pwh-pwh/cal-mcp'

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