batchGetDateByTimestamp
Convert a list of timestamps into readable date formats for efficient processing and analysis of multiple time-based data points.
Instructions
Batch convert the provided list of timestamps to date format, used for processing multiple timestamps
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tsList | Yes |
Implementation Reference
- index.ts:37-53 (registration)Registration of the batchGetDateByTimestamp tool with FastMCP server, including name, description, schema, and execute 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, }; }, });
- index.ts:40-42 (schema)Zod input schema for the tool: requires tsList as an array of numbers.parameters: z.object({ tsList: z.array(z.number()), }),
- index.ts:43-52 (handler)The tool's execute handler: calls the batchGetDateByTimestamp helper on input tsList, maps results to 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, }; },
- index.ts:75-77 (helper)Helper function implementing the core batch conversion logic: maps each timestamp to a date string via getDateByTimestamp.function batchGetDateByTimestamp(tsList: number[]) { return tsList.map(timestamp => getDateByTimestamp(timestamp)); }
- index.ts:71-73 (helper)Supporting utility function: converts a single timestamp to localized date string, used by batchGetDateByTimestamp.function getDateByTimestamp(ts: number) { return new Date(ts).toLocaleString() }