getCurrentTimestamp
Retrieve the current local timestamp in seconds or milliseconds for precise time synchronization or logging in the Whistle MCP Server environment.
Instructions
获取当前本地时间戳
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:458-461 (handler)The execute handler for the getCurrentTimestamp tool, which returns the current Unix timestamp in milliseconds using Date.now(), wrapped in the standard response format.execute: async () => { const timestamp = Date.now(); return formatResponse({ timestamp }); },
- src/index.ts:454-462 (registration)Registration of the getCurrentTimestamp tool using server.addTool, including name, description, empty Zod input schema, and inline handler function.server.addTool({ name: "getCurrentTimestamp", description: "获取当前本地时间戳", parameters: z.object({}), execute: async () => { const timestamp = Date.now(); return formatResponse({ timestamp }); }, });
- src/index.ts:21-30 (helper)Shared helper function that formats tool outputs into the MCP-standard content array with JSON-stringified text payload. Used by getCurrentTimestamp and all other tools.function formatResponse(data: any) { return { content: [ { type: "text" as const, text: JSON.stringify(data), }, ], }; }