deleteCalendar
Remove a calendar from Apple Calendar by specifying its calendarId, enabling users to manage their calendar organization through the MCP Apple Calendars server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| calendarId | Yes |
Implementation Reference
- src/index.ts:268-296 (registration)Registration of the "deleteCalendar" MCP tool, including inline Zod schema for input (calendarId: string) and the handler function that invokes calendars.deleteCalendar and formats the response.server.tool( "deleteCalendar", { calendarId: z.string() }, async ({ calendarId }) => { try { const success = await calendars.deleteCalendar(calendarId); return { content: [{ type: "text", text: JSON.stringify({ success, message: success ? "Calendar deleted" : "Failed to delete calendar" }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ error: "Failed to delete calendar" }) }], isError: true }; } } );
- src/calendars.ts:234-242 (handler)Handler function implementing the core logic to delete a calendar by making a DELETE request to the API endpoint.export async function deleteCalendar(calendarId: string): Promise<boolean> { try { await axios.delete(`${API_BASE_URL}/calendars/${calendarId}`); return true; } catch (error) { console.error(`Failed to delete calendar "${calendarId}":`, error); throw new Error(`Failed to delete calendar: ${error}`); } }