deleteCalendarEvent
Remove calendar events from Apple Calendar by specifying calendar and event IDs to manage schedules and clean up outdated appointments.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| calendarId | Yes | ||
| eventId | Yes |
Implementation Reference
- src/index.ts:242-264 (handler)The MCP tool handler that executes the tool logic: calls the helper, processes success/failure, and returns formatted MCP response.async ({ calendarId, eventId }) => { try { const success = await calendars.deleteCalendarEvent(calendarId, eventId); return { content: [{ type: "text", text: JSON.stringify({ success, message: success ? "Event deleted" : "Failed to delete event" }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: "Failed to delete event" }) }], isError: true }; } }
- src/index.ts:238-241 (schema)Input schema using Zod for validating calendarId and eventId parameters.{ calendarId: z.string(), eventId: z.string() },
- src/index.ts:236-265 (registration)Registration of the deleteCalendarEvent tool with MCP server, including schema and handler.server.tool( "deleteCalendarEvent", { calendarId: z.string(), eventId: z.string() }, async ({ calendarId, eventId }) => { try { const success = await calendars.deleteCalendarEvent(calendarId, eventId); return { content: [{ type: "text", text: JSON.stringify({ success, message: success ? "Event deleted" : "Failed to delete event" }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: "Failed to delete event" }) }], isError: true }; } } );
- src/calendars.ts:221-229 (helper)Supporting helper function that performs the actual HTTP DELETE request to the Calendar API Bridge.export async function deleteCalendarEvent(calendarId: string, eventId: string): Promise<boolean> { try { await axios.delete(`${API_BASE_URL}/calendars/${calendarId}/events/${eventId}`); return true; } catch (error) { console.error(`Failed to delete event "${eventId}" from calendar "${calendarId}":`, error); throw new Error(`Failed to delete calendar event: ${error}`); } }