calendar-create-event
Create new Google Calendar events by specifying title, time, location, attendees, and description for scheduling appointments, meetings, and reminders.
Instructions
Create a new calendar event. Current time: 10/2/2025, 1:06:07 AM
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attendees | No | Array of attendee email addresses | |
| calendarId | No | Calendar ID - Available options: 'primary' (Primary Calendar) | primary |
| description | No | Event description | |
| endDateTime | Yes | End date/time in ISO format (e.g., '2025-01-15T10:00:00-07:00') | |
| location | No | Event location | |
| startDateTime | Yes | Start date/time in ISO format (e.g., '2025-01-15T09:00:00-07:00') | |
| summary | Yes | Event title/summary | |
| timeZone | No | Time zone - defaults to local time (UTC). Examples: 'America/New_York', 'Europe/London', 'Asia/Tokyo' |
Input Schema (JSON Schema)
{
"properties": {
"attendees": {
"description": "Array of attendee email addresses",
"items": {
"type": "string"
},
"type": "array"
},
"calendarId": {
"default": "primary",
"description": "Calendar ID - Available options: 'primary' (Primary Calendar)",
"type": "string"
},
"description": {
"description": "Event description",
"type": "string"
},
"endDateTime": {
"description": "End date/time in ISO format (e.g., '2025-01-15T10:00:00-07:00')",
"type": "string"
},
"location": {
"description": "Event location",
"type": "string"
},
"startDateTime": {
"description": "Start date/time in ISO format (e.g., '2025-01-15T09:00:00-07:00')",
"type": "string"
},
"summary": {
"description": "Event title/summary",
"type": "string"
},
"timeZone": {
"description": "Time zone - defaults to local time (UTC). Examples: 'America/New_York', 'Europe/London', 'Asia/Tokyo'",
"type": "string"
}
},
"required": [
"summary",
"startDateTime",
"endDateTime"
],
"type": "object"
}
Implementation Reference
- src/calendar.ts:280-342 (handler)The main handler function `createEvent` that executes the core logic: authenticates with Google Calendar API, constructs the event object from params, inserts the event, formats the response as Markdown, and handles errors.export async function createEvent( params: z.infer<ReturnType<typeof createEventSchema>> ) { try { const auth = createCalendarAuth(); const calendar = google.calendar({ version: "v3", auth }); const event: any = { summary: params.summary, description: params.description, location: params.location, start: { dateTime: params.startDateTime, timeZone: params.timeZone, }, end: { dateTime: params.endDateTime, timeZone: params.timeZone, }, }; if (params.attendees && params.attendees.length > 0) { event.attendees = params.attendees.map((email) => ({ email })); } const response = await calendar.events.insert({ calendarId: params.calendarId, requestBody: event, sendUpdates: "all", // Send invitations to attendees }); const eventData = { id: response.data.id, summary: response.data.summary, start: response.data.start, end: response.data.end, location: response.data.location, description: response.data.description, attendees: response.data.attendees, htmlLink: response.data.htmlLink, }; return { content: [ { type: "text" as const, text: `# Event Created Successfully β \n\n${formatEventToMarkdown(eventData)}`, }, ], }; } catch (error) { return { content: [ { type: "text" as const, text: `Error creating event: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } }
- src/calendar.ts:135-164 (schema)Zod schema definition `createEventSchema` for input validation, including fields like summary, dates, attendees, calendarId with dynamic description.export const createEventSchema = () => z.object({ summary: z.string().describe("Event title/summary"), description: z.string().optional().describe("Event description"), location: z.string().optional().describe("Event location"), startDateTime: z .string() .describe( "Start date/time in ISO format (e.g., '2025-01-15T09:00:00-07:00')" ), endDateTime: z .string() .describe( "End date/time in ISO format (e.g., '2025-01-15T10:00:00-07:00')" ), attendees: z .array(z.string()) .optional() .describe("Array of attendee email addresses"), calendarId: z .string() .default("primary") .describe(getCalendarDescription()), timeZone: z .string() .optional() .describe( `Time zone - defaults to local time (${systemTimezone}). Examples: 'America/New_York', 'Europe/London', 'Asia/Tokyo'` ), });
- src/index.ts:215-222 (registration)Tool registration in MCP server using `server.tool()`, linking to `createEvent` handler and `createEventSchema`.server.tool( "calendar-create-event", "Create a new calendar event. Current time: " + new Date().toLocaleString(), createEventSchema().shape, async (params) => { return await createEvent(params); } );