calendar-delete-event
Remove calendar events by specifying the event ID and calendar ID to manage schedules and clean up outdated appointments.
Instructions
Delete a calendar event
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventId | Yes | Event ID | |
| calendarId | No | Calendar ID - Available options: 'primary' (Primary Calendar) | primary |
Implementation Reference
- src/calendar.ts:541-574 (handler)The handler function that performs the actual deletion of a calendar event using the Google Calendar API. It takes eventId and optional calendarId, deletes the event, and returns a success or error message.export async function deleteEvent( params: z.infer<ReturnType<typeof deleteEventSchema>> ) { try { const auth = createCalendarAuth(); const calendar = google.calendar({ version: "v3", auth }); await calendar.events.delete({ calendarId: params.calendarId, eventId: params.eventId, sendUpdates: "all", }); return { content: [ { type: "text" as const, text: `# Event Deleted Successfully ✅\n\nEvent \`${params.eventId}\` has been deleted from your calendar.`, }, ], }; } catch (error) { return { content: [ { type: "text" as const, text: `Error deleting event: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } }
- src/calendar.ts:226-233 (schema)Zod schema defining the input parameters for the delete event tool: eventId (required) and calendarId (optional, defaults to 'primary').export const deleteEventSchema = () => z.object({ eventId: z.string().describe("Event ID"), calendarId: z .string() .default("primary") .describe(getCalendarDescription()), });
- src/index.ts:251-258 (registration)Registration of the 'calendar-delete-event' tool on the MCP server, linking the name, description, schema, and handler function.server.tool( "calendar-delete-event", "Delete a calendar event", deleteEventSchema().shape, async (params) => { return await deleteEvent(params); } );