Schedule care and transfer prescriptions

Book, reschedule, or cancel appointments and transfer a prescription from the assistant

These tools act outside b.well. They book, reschedule, and cancel appointments with the user's health system, and transfer a prescription to a pharmacy store for pickup.

Before you start

These tools are optional; leave them out if users book care or transfer prescriptions in your web app. The health systems, providers, and pharmacy partners they reach are configured for your client. Contact b.well for what's available for your client and environment, and for your scheduling_client value. Booking also uses provider_search from Provider Search & Data Connections, so check your tools/list result for it before you build on these tools. Scheduling & Appointments and Pharmacy document each tool.

The server doesn't confirm register_patient, schedule_appointment, reschedule_appointment, cancel_appointment, or transfer_prescription, so configure your host to ask the user before each one runs, or ask in your application if your host has no approval setting.

Book an appointment

This sequence uses Direct Scheduling (is_direct_scheduling: true, the default), with a provider the user already sees through the health system's patient portal.

  1. Call provider_search to find the provider's NPI and the facility ID of their department.
  2. Call get_visit_types and keep the code of the visit type the user chooses. If it fails because the user isn't registered with the health system, call register_patient with the facility ID as department_id, then call get_visit_types again.
  3. Call search_scheduling_slots with that code and the provider and facility IDs.
  4. Call schedule_appointment with the slot the user picks. Its section shows how each argument maps from the slot.

If schedule_appointment returns no appointment, the booking may still exist, so check get_appointments before you retry.

Reschedule or cancel

  1. Call get_appointments and find the appointment the user means. Its id is the appointment_id the next step takes.
  2. To reschedule, find a new slot with search_scheduling_slots, then call reschedule_appointment. To cancel, call get_cancel_reasons, then cancel_appointment with the reason the user picks.

Transfer a prescription

  1. Call check_transfer_eligibility with the bare id of the prescription's MedicationRequest.
  2. Call find_pharmacy_stores with the user's ZIP code, then get_pharmacy_hours for the chosen store's pickup times.
  3. Call transfer_prescription with the store and pickup time the user picks, the patient details from get_user_profile, and the Rx number and current pharmacy's name and phone, which you ask the user for. No tool cancels or reverses a transfer, and a failed call can still have submitted it, so don't retry it automatically.

Guide the model

These points add to the base guidance. Use them if your host accepts your own instructions, and adapt them to your use case. They reinforce the tool descriptions and don't replace them. Your host's or your application's approval is what keeps the user in control of these writes; these points help the model ask at the right moment.

  • Before booking, rescheduling, or cancelling an appointment, or transferring a prescription, restate the details (provider, location, date, time, and time zone, or pharmacy and pickup time) and wait for the user to confirm.
  • Pass the timezone from search_scheduling_slots to schedule_appointment as timezone_title. Without it, a fixed fallback time zone applies.
  • Pass the user's location when searching for providers or pharmacies, and ask for it if you don't have it.
  • If schedule_appointment returns no appointment, check get_appointments before trying again.
  • Never retry transfer_prescription automatically. If it fails, tell the user.
  • Ask the user for the Rx number and their current pharmacy's name and phone number rather than guessing.

Did this page help you?