create_event
Add new events to Google Calendar without the risk of deletion. Specify title, start/end times, location, description, and attendee emails.
Instructions
Create a new calendar event
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attendees | No | List of attendee email addresses | |
| description | No | Event description | |
| end | Yes | End time in ISO format | |
| location | No | Event location | |
| start | Yes | Start time in ISO format | |
| summary | Yes | Event title |
Implementation Reference
- src/index.ts:447-489 (handler)The main handler function that creates a new calendar event using Google Calendar API. It destructures arguments, builds the event object with timezone, inserts into primary calendar, and returns success or formatted error.private async handleCreateEvent(args: any) { try { const { summary, location, description, start, end, attendees = [] } = args; const event = { summary, location, description, start: { dateTime: start, timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone, }, end: { dateTime: end, timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone, }, attendees: attendees.map((email: string) => ({ email })), }; const response = await this.calendar.events.insert({ calendarId: 'primary', requestBody: event, }); return { content: [ { type: 'text', text: `Event created successfully. Event ID: ${response.data.id}`, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error creating event: ${error.message}`, }, ], isError: true, }; }
- src/index.ts:176-206 (schema)Input schema for the create_event tool, specifying required fields (summary, start, end) and optional fields (location, description, attendees).inputSchema: { type: 'object', properties: { summary: { type: 'string', description: 'Event title', }, location: { type: 'string', description: 'Event location', }, description: { type: 'string', description: 'Event description', }, start: { type: 'string', description: 'Start time in ISO format', }, end: { type: 'string', description: 'End time in ISO format', }, attendees: { type: 'array', items: { type: 'string' }, description: 'List of attendee email addresses', }, }, required: ['summary', 'start', 'end'] },
- src/index.ts:173-207 (registration)Registers the create_event tool in the ListToolsRequestSchema handler, providing name, description, and input schema.{ name: 'create_event', description: 'Create a new calendar event', inputSchema: { type: 'object', properties: { summary: { type: 'string', description: 'Event title', }, location: { type: 'string', description: 'Event location', }, description: { type: 'string', description: 'Event description', }, start: { type: 'string', description: 'Start time in ISO format', }, end: { type: 'string', description: 'End time in ISO format', }, attendees: { type: 'array', items: { type: 'string' }, description: 'List of attendee email addresses', }, }, required: ['summary', 'start', 'end'] }, },
- src/index.ts:240-241 (registration)In the CallToolRequestSchema handler, routes 'create_event' tool calls to the handleCreateEvent method.case 'create_event': return await this.handleCreateEvent(request.params.arguments);