calcom_update_appointment
Modify existing Cal.com appointments by rescheduling times or updating notes using the booking ID.
Instructions
Updates an existing appointment in Cal.com calendar. Use this for rescheduling or modifying existing appointments. Requires booking ID and the fields to update.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bookingId | Yes | The Cal.com booking ID to update | |
| startTime | No | New start time in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ) | |
| endTime | No | New end time in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ) | |
| notes | No | New notes for the appointment |
Implementation Reference
- index.ts:295-324 (handler)The main handler function that executes the tool logic: validates optional fields, constructs update data, calls Cal.com API PATCH /bookings/{bookingId}, and returns success message or throws error.async function updateAppointment( bookingId: number, startTime?: string, endTime?: string, notes?: string ) { checkRateLimit(); try { const updateData: Record<string, any> = {}; if (startTime) updateData.start = new Date(startTime).toISOString(); if (endTime) updateData.end = new Date(endTime).toISOString(); if (notes !== undefined) updateData.notes = notes; const response = await calComApiClient.patch(`/bookings/${bookingId}`, updateData); const booking = response.data; return `Appointment updated successfully! Booking ID: ${booking.id} ${startTime ? `New Start Time: ${booking.startTime}` : ""} ${endTime ? `New End Time: ${booking.endTime}` : ""} ${notes !== undefined ? `New Notes: ${notes}` : ""}`; } catch (error: any) { if (axios.isAxiosError(error)) { throw new Error(`Failed to update appointment: ${error.response?.data?.message || error.message}`); } throw new Error(`Failed to update appointment: ${String(error)}`); } }
- index.ts:223-234 (schema)Type guard function for input schema validation of calcom_update_appointment arguments.function isCalComUpdateAppointmentArgs(args: unknown): args is { bookingId: number; startTime?: string; endTime?: string; notes?: string; } { return ( typeof args === "object" && args !== null && "bookingId" in args ); }
- index.ts:50-78 (registration)Tool registration object defining name, description, and JSON inputSchema for calcom_update_appointment.const UPDATE_APPOINTMENT_TOOL: Tool = { name: "calcom_update_appointment", description: "Updates an existing appointment in Cal.com calendar. " + "Use this for rescheduling or modifying existing appointments. " + "Requires booking ID and the fields to update. ", inputSchema: { type: "object", properties: { bookingId: { type: "number", description: "The Cal.com booking ID to update" }, startTime: { type: "string", description: "New start time in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ)" }, endTime: { type: "string", description: "New end time in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ)" }, notes: { type: "string", description: "New notes for the appointment" } }, required: ["bookingId"], } };
- index.ts:409-419 (handler)Dispatcher handler case within CallToolRequestSchema that performs arg validation and delegates to the updateAppointment function.case "calcom_update_appointment": { if (!isCalComUpdateAppointmentArgs(args)) { throw new Error("Invalid arguments for calcom_update_appointment"); } const { bookingId, startTime, endTime, notes } = args; const result = await updateAppointment(bookingId, startTime, endTime, notes); return { content: [{ type: "text", text: result }], isError: false, }; }