advancedmd_transfer_balance, the AdvancedMD charge-balance transfer tool exposed through the Agents Platform. It reassigns responsibility on a single charge between the patient and insurance sides — moving the balance and the responsibility portion together — via the AdvancedMD updvisitwithcharges API. For locating the charge first, see AdvancedMD Find Charge; for detaching a payment (which optionally does the same patient→insurance move afterward), see AdvancedMD Unapply Payment.
Authentication
AdvancedMD transfer balance uses the existing AdvancedMD connector:office_codeusernamepassword
advancedmd_not_connected result with suggested actions (Connect AdvancedMD and try again / Stop task).
Safety
advancedmd_transfer_balance is a mutating billing tool. It issues an updvisitwithcharges write, a non-idempotent financial write that never replays on HTTP 429.
dry_run defaults to false (the tool transfers immediately, matching advancedmd_unapply_payment). Set dry_run=true to preview the call without executing it.
The tool reads the charge’s live balances/portions from AdvancedMD first, then writes the new split. Two guards protect against AdvancedMD’s CD_Balances CHECK constraint (“Insurance Balance cannot be negative”):
- The transfer amount cannot exceed the source side’s balance or its portion.
- Any transfer that would leave either side’s balance below zero is refused before the write (this is what happens if a credit/overpayment is pushed onto a side).
proccode, diagcodes, modcodes, respparty) and line fields (fee, allowed, netfee, units, pos, tos, finclasscode, billins) alongside the new balances/portions, which AdvancedMD’s CD_FIDReferences constraint requires on a charge write.
Provider profile & facility preservation
updvisitwithcharges rewrites the visit record and clears any attribute it is not given, and the billing provider/facility are @profile/@facility on the visit element (AMD API docs June 2025) — omitting them is what reset 58 charges to a blank provider. This write now reads the visit record from getchargedetaildataicd10, echoes those values back, refuses to run if the provider cannot be read, and re-reads it afterwards to confirm it survived. ADVANCEDMD_CHARGE_WRITE_ENABLED=false is the ops kill switch. Full background: AdvancedMD Unapply Payment — Provider profile & facility preservation.
Inputs
Required:charge_id: AdvancedMD charge ID whose balance to transfer (fromadvancedmd_find_charge’sehr_charge_id). A leadingchargeprefix is stripped automatically.
dry_run: Defaults tofalse. Whentrue, returns the transfer that would be made without executing it.direction:to_insurance(move patient responsibility onto insurance) orto_patient(move insurance responsibility onto the patient). Defaults toto_insurance.amount: Decimal amount to transfer. Omit to move the full outstanding balance of the source side. Must be positive and cannot exceed the source side’s balance or portion.patient_id/visit_id: Only used when AdvancedMD’s charge detail response doesn’t identify the patient/visit itself (the tool errors asking for them if so).advancedmd_find_chargereturns both (ehr_patient_id,ehr_visit_id).
Recommended Workflow
- Use
advancedmd_find_chargeto locate the charge (ehr_charge_id, plusehr_patient_id/ehr_visit_id) and read its current balances/portions. - Call
advancedmd_transfer_balancewithdry_run=trueand review the preview. - Call again with
dry_run=false(or omitdry_run) to execute. - Confirm
transferredistrueand the before/after amounts in the summary table.
Dry-Run Example
Partial Transfer Example
Error Handling
The tool returns a structured tool error for invalid inputs (missingcharge_id, an unknown direction, a non-positive amount), for an amount that exceeds the source side’s balance/portion, and for a transfer that would drive a balance negative. It surfaces AdvancedMD faults (e.g. a closed period) as tool errors and does not retry.
When the source side has no positive balance to move, the tool returns a success result with transferred: false and a message (e.g. “No patient responsibility to transfer”) rather than an error — there is simply nothing to do.
Output
The structured output includes:transferred:truewhen AdvancedMD accepted the write.dry_run: whether the call was a dry run.charge_id: the normalized charge ID.direction:patient_to_insuranceorinsurance_to_patient.transfer: the transfer outcome —amount, the previous patient/insurance balance and portion, and the new patient/insurance balance and portion; plus amessagewhen nothing was transferred.