getTodayDate
Retrieve today's date in YYYY-MM-DD format for the local timezone to avoid hardcoding dates in workflows.
Instructions
Get today's date in local timezone (YYYY-MM-DD format). Use this tool whenever you need today's date - NEVER hardcode dates.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| random_string | No | Dummy parameter for no-parameter tools |
Implementation Reference
- dist/index.js:195-209 (handler)The async handler function that computes today's date using new Date() in local timezone and formats it as YYYY-MM-DD, returning it as text content.}, async () => { const today = new Date(); const year = today.getFullYear(); const month = String(today.getMonth() + 1).padStart(2, '0'); const day = String(today.getDate()).padStart(2, '0'); const todayDate = `${year}-${month}-${day}`; return { content: [ { type: "text", text: todayDate } ] }; });
- dist/index.js:192-194 (schema)Input schema definition using Zod, with an optional dummy string parameter to support no-parameter tools.random_string: z.string() .optional() .describe("Dummy parameter for no-parameter tools")
- dist/index.js:191-209 (registration)Full registration of the getTodayDate tool via server.tool(), including name, description, schema, and inline handler function.server.tool("getTodayDate", "Get today's date in local timezone (YYYY-MM-DD format). Use this tool whenever you need today's date - NEVER hardcode dates.", { random_string: z.string() .optional() .describe("Dummy parameter for no-parameter tools") }, async () => { const today = new Date(); const year = today.getFullYear(); const month = String(today.getMonth() + 1).padStart(2, '0'); const day = String(today.getDate()).padStart(2, '0'); const todayDate = `${year}-${month}-${day}`; return { content: [ { type: "text", text: todayDate } ] }; });