deleteCalendar
Remove a specific calendar from Apple Calendar using the calendar ID. This tool enables precise management of calendar data on macOS through the MCP Apple Calendars server.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| calendarId | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"calendarId": {
"type": "string"
}
},
"required": [
"calendarId"
],
"type": "object"
}
Implementation Reference
- src/index.ts:273-296 (handler)MCP tool handler function for 'deleteCalendar' that invokes calendars.deleteCalendar and returns a formatted MCP response.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/index.ts:270-271 (schema)Zod input schema for the 'deleteCalendar' tool requiring a calendarId string.{ calendarId: z.string()
- src/index.ts:268-296 (registration)Registration of the 'deleteCalendar' MCP tool using server.tool, including name, schema, and handler.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 (helper)Supporting function that performs the actual HTTP DELETE request to the calendar API bridge to delete the specified calendar.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}`); } }