calcom_update_appointment
Modify existing Cal.com appointments by rescheduling times or updating notes using booking ID and new details.
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)Core handler function that performs the API call to update the Cal.com appointment with provided changes.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:409-419 (handler)Tool dispatcher case within CallToolRequestSchema handler that validates arguments and invokes 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, }; }
- index.ts:50-78 (registration)Defines the Tool metadata including name, description, and input schema for registration.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:223-234 (schema)Input validation type guard for tool 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:379-386 (registration)Registers the tool by including it in the ListTools response.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ ADD_APPOINTMENT_TOOL, UPDATE_APPOINTMENT_TOOL, DELETE_APPOINTMENT_TOOL, LIST_APPOINTMENTS_TOOL ], }));