delete_event
Remove specific events from Google Calendar by specifying the event ID and calendar ID, ensuring efficient event management through the Google Calendar MCP Server.
Instructions
Delete an event from Google Calendar
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| calendarId | No | Calendar ID (default: 'primary') | primary |
| eventId | Yes | Event ID to delete |
Input Schema (JSON Schema)
{
"properties": {
"calendarId": {
"default": "primary",
"description": "Calendar ID (default: 'primary')",
"type": "string"
},
"eventId": {
"description": "Event ID to delete",
"type": "string"
}
},
"required": [
"eventId"
],
"type": "object"
}
Implementation Reference
- src/index.ts:467-498 (handler)The main handler function that executes the delete_event tool logic by calling the Google Calendar API to delete the specified event.async function handleDeleteEvent(args: z.infer<typeof DeleteEventArgsSchema>) { try { await calendar.events.delete({ calendarId: args.calendarId, eventId: args.eventId, }); return { content: [ { type: "text", text: JSON.stringify({ success: true, message: `Event "${args.eventId}" deleted successfully`, }, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error", }, null, 2), }, ], isError: true, }; }
- src/index.ts:87-90 (schema)Zod schema used for input validation of delete_event arguments.const DeleteEventArgsSchema = z.object({ calendarId: z.string().optional().default("primary"), eventId: z.string(), });
- src/index.ts:292-310 (registration)Tool registration in the tools array, defining the name, description, and JSON input schema for the MCP protocol.{ name: "delete_event", description: "Delete an event from Google Calendar", inputSchema: { type: "object", properties: { calendarId: { type: "string", description: "Calendar ID (default: 'primary')", default: "primary", }, eventId: { type: "string", description: "Event ID to delete", }, }, required: ["eventId"], }, },
- src/index.ts:559-562 (handler)Dispatch case in the main CallToolRequest handler that validates arguments and calls the specific delete_event handler.case "delete_event": { const validatedArgs = DeleteEventArgsSchema.parse(args); return await handleDeleteEvent(validatedArgs); }