update_patient
Update an existing patient's demographic, contact, and address details using their unique patient ID.
Instructions
Update an existing patient
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| patient_id | Yes | Patient ID | |
| first_name | No | Patient first name | |
| last_name | No | Patient last name | |
| title | No | Title (Mr, Ms, Dr, etc) | |
| preferred_name | No | Preferred name | |
| date_of_birth | No | Date of birth (YYYY-MM-DD) | |
| sex | No | Biological sex | |
| No | Email address | ||
| phone_number | No | Primary phone number | |
| address_line_1 | No | Address line 1 | |
| address_line_2 | No | Address line 2 | |
| suburb | No | Suburb/City | |
| postcode | No | Postcode | |
| state | No | State/Province | |
| country | No | Country | |
| medicare_number | No | Medicare number | |
| medicare_reference_number | No | Medicare reference number |
Implementation Reference
- src/tools/patients.ts:157-228 (handler)The 'update_patient' tool handler. It accepts a patient_id (required) plus optional fields, destructures them, maps fields to the API format (including phone_numbers as array and address as nested object), then calls client.updatePatient().
// Update patient server.tool('update_patient', { description: 'Update an existing patient', inputSchema: { type: 'object', properties: { patient_id: { type: 'number', description: 'Patient ID' }, first_name: { type: 'string', description: 'Patient first name' }, last_name: { type: 'string', description: 'Patient last name' }, title: { type: 'string', description: 'Title (Mr, Ms, Dr, etc)' }, preferred_name: { type: 'string', description: 'Preferred name' }, date_of_birth: { type: 'string', description: 'Date of birth (YYYY-MM-DD)' }, sex: { type: 'string', enum: ['Male', 'Female', 'Other'], description: 'Biological sex' }, email: { type: 'string', description: 'Email address' }, phone_number: { type: 'string', description: 'Primary phone number' }, address_line_1: { type: 'string', description: 'Address line 1' }, address_line_2: { type: 'string', description: 'Address line 2' }, suburb: { type: 'string', description: 'Suburb/City' }, postcode: { type: 'string', description: 'Postcode' }, state: { type: 'string', description: 'State/Province' }, country: { type: 'string', description: 'Country' }, medicare_number: { type: 'string', description: 'Medicare number' }, medicare_reference_number: { type: 'string', description: 'Medicare reference number' } }, required: ['patient_id'] }, }, async (input: any) => { try { const { patient_id, ...updateData } = input; const patientData: any = {}; // Map simple fields if (updateData.first_name) patientData.first_name = updateData.first_name; if (updateData.last_name) patientData.last_name = updateData.last_name; if (updateData.title) patientData.title = updateData.title; if (updateData.preferred_name) patientData.preferred_name = updateData.preferred_name; if (updateData.date_of_birth) patientData.date_of_birth = updateData.date_of_birth; if (updateData.sex) patientData.sex = updateData.sex; if (updateData.email) patientData.email = updateData.email; if (updateData.medicare_number) patientData.medicare_number = updateData.medicare_number; if (updateData.medicare_reference_number) patientData.medicare_reference_number = updateData.medicare_reference_number; // Handle phone numbers if (updateData.phone_number) { patientData.phone_numbers = [{ number: updateData.phone_number, type: 'Mobile' }]; } // Handle address if (updateData.address_line_1 || updateData.suburb || updateData.postcode) { patientData.address = {}; if (updateData.address_line_1) patientData.address.line_1 = updateData.address_line_1; if (updateData.address_line_2) patientData.address.line_2 = updateData.address_line_2; if (updateData.suburb) patientData.address.suburb = updateData.suburb; if (updateData.postcode) patientData.address.postcode = updateData.postcode; if (updateData.state) patientData.address.state = updateData.state; if (updateData.country) patientData.address.country = updateData.country; } const patient = await client.updatePatient(patient_id, patientData); return { content: [{ type: 'text', text: JSON.stringify(patient, null, 2) }] }; } catch (error) { throw new Error(`Failed to update patient: ${error instanceof Error ? error.message : 'Unknown error'}`); } }); - src/tools/patients.ts:158-182 (schema)Input schema for 'update_patient': patient_id (required number), plus optional fields: first_name, last_name, title, preferred_name, date_of_birth, sex (enum), email, phone_number, address fields, medicare fields.
server.tool('update_patient', { description: 'Update an existing patient', inputSchema: { type: 'object', properties: { patient_id: { type: 'number', description: 'Patient ID' }, first_name: { type: 'string', description: 'Patient first name' }, last_name: { type: 'string', description: 'Patient last name' }, title: { type: 'string', description: 'Title (Mr, Ms, Dr, etc)' }, preferred_name: { type: 'string', description: 'Preferred name' }, date_of_birth: { type: 'string', description: 'Date of birth (YYYY-MM-DD)' }, sex: { type: 'string', enum: ['Male', 'Female', 'Other'], description: 'Biological sex' }, email: { type: 'string', description: 'Email address' }, phone_number: { type: 'string', description: 'Primary phone number' }, address_line_1: { type: 'string', description: 'Address line 1' }, address_line_2: { type: 'string', description: 'Address line 2' }, suburb: { type: 'string', description: 'Suburb/City' }, postcode: { type: 'string', description: 'Postcode' }, state: { type: 'string', description: 'State/Province' }, country: { type: 'string', description: 'Country' }, medicare_number: { type: 'string', description: 'Medicare number' }, medicare_reference_number: { type: 'string', description: 'Medicare reference number' } }, required: ['patient_id'] }, - src/tools/patients.ts:158-158 (registration)Tool registration via server.tool('update_patient', ...) inside registerPatientTools().
server.tool('update_patient', { - src/cliniko-client.ts:73-78 (helper)The client method updatePatient() performs a PUT request to /patients/{id} with the JSON body, returning the updated Patient.
async updatePatient(id: number, patient: Partial<Patient>): Promise<Patient> { return this.request<Patient>(`/patients/${id}`, { method: 'PUT', body: JSON.stringify(patient), }); }