Delete an appointment
delete_appointmentDelete a scheduled appointment from your Cozi Family Organizer calendar by specifying the appointment ID, year, and month.
Instructions
Delete an appointment. Returns true on success.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appointment_id | Yes | ||
| year | Yes | ||
| month | Yes |
Implementation Reference
- src/tools/calendar.ts:102-109 (handler)The deleteAppointmentHandler function that executes the tool logic. It calls client.deleteAppointment(appointmentId, year, month) and returns a boolean indicating success.
export async function deleteAppointmentHandler( client: CoziClient, appointmentId: string, year: number, month: number, ): Promise<boolean> { return client.deleteAppointment(appointmentId, year, month); } - src/tools/calendar.ts:199-214 (registration)Registration of the 'delete_appointment' tool on the MCP server via server.registerTool(). Defines inputSchema with appointment_id, year, month.
server.registerTool( 'delete_appointment', { title: 'Delete an appointment', description: 'Delete an appointment. Returns true on success.', inputSchema: { appointment_id: z.string(), year: z.number().int(), month: z.number().int().min(1).max(12), }, }, async ({ appointment_id, year, month }) => { const result = await deleteAppointmentHandler(await getClient(), appointment_id, year, month); return { content: [{ type: 'text', text: JSON.stringify(result) }] }; }, ); - src/cozi/client.ts:317-325 (helper)The CoziClient.deleteAppointment method on the client. It sends a POST request to the calendar endpoint with a delete payload formatted by toApiDeleteFormat().
async deleteAppointment(appointmentId: string, year: number, month: number): Promise<boolean> { await this.ensureAuthenticated(); await this.http.request({ method: 'POST', endpoint: this.accountEndpoint(`/calendar/${year}/${month}`), body: [toApiDeleteFormat({ id: appointmentId } as CoziAppointment)], }); return true; } - The toApiDeleteFormat helper that creates the API request body for deleting an appointment.
export function toApiDeleteFormat(a: CoziAppointment): Record<string, unknown> { if (!a.id) throw new ValidationError('Cannot delete appointment without ID'); return { itemType: 'appointment', delete: { id: a.id } }; } - src/tools/calendar.ts:204-208 (schema)Input schema for the delete_appointment tool: appointment_id (string), year (int), month (int 1-12).
inputSchema: { appointment_id: z.string(), year: z.number().int(), month: z.number().int().min(1).max(12), },