productivity_calendar_event
Create calendar events in iCal format for scheduling and time management. Specify title, date, time, duration, and description to generate structured calendar entries.
Instructions
Generate a calendar event in iCal format
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Event title | |
| date | Yes | Date (YYYY-MM-DD) | |
| time | No | Time (HH:MM) | 09:00 |
| duration_minutes | No | Duration in minutes | |
| description | No | Event description |
Implementation Reference
- src/modules/productivity.ts:66-79 (handler)The tool `productivity_calendar_event` is defined, schema-validated, and implemented within the `registerProductivityTools` function in `src/modules/productivity.ts`. It takes title, date, time, duration_minutes, and description as inputs and returns an iCal formatted string.
server.tool("productivity_calendar_event", "Generate a calendar event in iCal format", { title: z.string().describe("Event title"), date: z.string().describe("Date (YYYY-MM-DD)"), time: z.string().default("09:00").describe("Time (HH:MM)"), duration_minutes: z.number().default(60).describe("Duration in minutes"), description: z.string().default("").describe("Event description") }, async ({ title, date, time, duration_minutes, description }) => { const start = `${date.replace(/-/g, "")}T${time.replace(":", "")}00`; const endDate = new Date(`${date}T${time}:00`); endDate.setMinutes(endDate.getMinutes() + duration_minutes); const end = endDate.toISOString().replace(/[-:]/g, "").split(".")[0]; const ical = `BEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\nDTSTART:${start}\nDTEND:${end}\nSUMMARY:${title}\nDESCRIPTION:${description}\nEND:VEVENT\nEND:VCALENDAR`; return { content: [{ type: "text", text: `**Calendar Event Created**\n\n**${title}**\nDate: ${date}\nTime: ${time}\nDuration: ${duration_minutes}min\n\n\`\`\`ical\n${ical}\n\`\`\`\n\n*Save as .ics file and import to your calendar.*` }] }; });