create_event
Add new events to iCloud calendars with details like title, time, location, and recurrence rules. Supports both timed and all-day events across multiple calendars.
Instructions
Create a new event in an iCloud calendar. For all-day events use allDay:true and YYYY-MM-DD for start/end.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| calendarId | Yes | Calendar ID to add the event to | |
| summary | Yes | Event title | |
| start | Yes | Start date/time — ISO 8601 (e.g. 2026-03-15T10:00:00) or YYYY-MM-DD for all-day | |
| end | No | End date/time — ISO 8601 or YYYY-MM-DD. Defaults to 1 hour after start. | |
| timezone | No | IANA timezone (e.g. America/New_York). Use "UTC" or omit for UTC. | |
| allDay | No | True for all-day event (uses DATE values, no time) | |
| description | No | Event description / notes | |
| location | No | Event location | |
| recurrence | No | iCal RRULE string (e.g. FREQ=WEEKLY;BYDAY=MO,WE,FR) | |
| status | No | Event status: CONFIRMED, TENTATIVE, or CANCELLED | |
| reminder | No | Alert this many minutes before the event (default 30, set to 0 to disable) |
Implementation Reference
- lib/caldav.js:401-417 (handler)The `createEvent` function sends a PUT request to the CalDAV server to create a new event. It uses `serializeVEvent` to format the calendar data.
export async function createEvent(calendarId, fields) { const { dataHost, calendarsPath } = await discover(); const { ical, uid } = serializeVEvent(fields); const eventId = uid; const url = `${dataHost}${calendarsPath}${calendarId}/${eventId}.ics`; const resp = await davRequest('PUT', url, { contentType: 'text/calendar; charset=utf-8', body: ical, }); if (resp.status !== 201 && resp.status !== 204 && resp.status !== 200) { throw new Error(`CalDAV PUT failed: ${resp.status} — ${resp.body.slice(0, 200)}`); } return { created: true, eventId, calendarId, etag: resp.etag }; }