advancedmd_find_charge, the native AdvancedMD charge lookup tool exposed through the Agents Platform.
Authentication
AdvancedMD tools use the existing AdvancedMD connector. Users configure:office_codeusernamepassword
amd_token and do not require callers to provide a direct processrequest.aspx URL.
advancedmd_find_charge
Finds an AdvancedMD charge by patient name, date of service, and CPT code. This is a read-only lookup tool intended to retrieve charge IDs, balances, portions, provider details, and responsible-party details.
Voided and settled charges
The transaction-history scan always requests the full history (@typefilter=0): AMD’s server-side filter also hides settled charges, which made freshly posted charges report “not found” on re-reads. Voided charges are filtered client-side instead, controlled by include_voided_charges.
Matching prefers a live charge: a voided row can never shadow a live replacement for the same DOS + CPT (the void-then-re-enter case). With include_voided_charges=true, a voided charge is returned only when no live match exists anywhere in the scanned pages, and it is flagged — match_is_voided: true in the structured output and a ⚠️ VOIDED row in the summary saying not to post to it.
Inputs
date_of_service accepts YYYY-MM-DD, MM/DD/YYYY and M/D/YYYY. EOB documents and AdvancedMD both print MM/DD/YYYY, and rejecting it caused two production tasks to fail outright on 2026-08-03 after four identical retries each.
Required:
patient_name: Patient name in a common format, such asJane SmithorSmith, Jane.date_of_service: ISO-8601 date,YYYY-MM-DD. The tool converts this to AdvancedMD’sMM/DD/YYYYformat internally.cpt_code: CPT code to match. Modifiers are allowed; matching uses the base CPT, so99213 25matches99213.
exact_match: Defaults totrue. Controls AdvancedMD patient-name lookup exact matching.max_patients: Defaults to10. Maximum patient candidates to inspect.max_transaction_pages: Defaults to10. Maximum transaction-history pages to inspect per patient.include_voided_charges: Defaults tofalse. When false, only active/non-voided charges are searched. Set to true only when the workflow intentionally needs to inspect voided charges.
Matching Behavior
The tool:- generates common patient-name variations before lookup,
- deduplicates patients by AdvancedMD patient ID,
- strips a leading
patprefix before calling transaction history, - pages through
gettxhistory, - matches by date of service and base CPT code,
- skips charges flagged as voided (
void != "0") unlessinclude_voided_charges=true— AdvancedMD’s server-side type filter alone does not reliably exclude voided charge rows, so they are filtered here too, - calls charge detail (
getchargedetaildataicd10) to enrich insurance/patient portions and balances. Both response shapes AdvancedMD uses are handled — a flat<charge>underResultsand the nestedpatientlist > patient > visitlist > visit > chargelist > chargeenvelope production tenants return. Transaction-history values are the fallback when the detail read has no value.
Output
On success, structured content includes:found: truepatient: matched AdvancedMD patient attributesmatch: EHR details such as charge ID, patient ID, visit ID, balances, portions, provider, carrier, and raw transaction fieldsmatch.ehr_carrier/match.ehr_carrier_name: the carrier currently attached to the charge (the payer the charge is assigned to for billing) from thegettxhistorycharge row — not the patient’s full insurance list, and distinct from the row’slastbilledcarrier(available inraw_transaction).ehr_carrieris the code (e.g.AET07);ehr_carrier_nameis its display name resolved vialookupcarrier(best-effort — empty if the lookup fails). A charge row carries exactly one carrier; when a claim crosses over, this value changes to the now-responsible carrier. For the patient’s full primary/secondary list with names, useadvancedmd_get_patient_insurances.patient_insurances(top-level, best-effort): the matched patient’s insurance plans on file fromgetdemographic— per plan: resolved carrier name (Carrier), raw AMD carrier code (CarrierCode),Active(raw AMD flag;"0"= inactive),Coverage(Primary/Secondary/…; AMD’s0maps toUnassigned),SubscriberNum,GrpNum, begin/end dates, relationship. Same shape asadvancedmd_get_patient_insurances. Omitted when the lookup fails or the patient has no plans on file. The summary table renders oneInsurance (Primary)/Insurance (Secondary)row per plan, hiding explicitly-inactive plans (the structured list keeps them all).match.applied_payments: the payments already applied to the matched charge, from the charge’s nestedpaymentlistingettxhistory. Each entry carriespayment_id(the ID AdvancedMD Unapply Payment takes),date,amount,check_number,pay_code,source,void,pay_reason_code, and the raw payment attributes. Checkvoidbefore acting on a payment — voided rows are included. Sign convention: AMD reports applied amounts sign-flipped — a $104.40 payment applied to the charge appears asamount: "-104.40"(prod-confirmed). When matching an EOB amount to a payment, compare against the absolute value.match.ehr_carrier_id/match.carrier_id: AdvancedMD’s carrier id (e.g.car7552), resolved from the samelookupcarriercall that provides the display name — this is what a payment’s@carrieridtakes, and passing it to AdvancedMD Post Payment saves that tool a lookup.carrier_idholds the same id once resolved (it previously carried the display code, the naming confusion behind the June regression) and falls back to the code when the lookup finds nothing. The display code itself stays inehr_carrier.match.applied_payments_reconciled: whether the listed non-voided payments account for the charge’s paid amount (within a cent, using the sign convention above). AMD often nests only part of a charge’s payments under the row a scan finds first (typically just adjustments); when the matched row doesn’t reconcile, the tool sweeps the remaining history pages and merges the same charge’s payments from its other transaction rows. If the list still doesn’t reconcile after the sweep, this flag isfalseand the summary adds a⚠️ Payments Incompleterow — the agent must not pick an unapply target from an incomplete list; verify in AdvancedMD instead. The sweep only runs when needed, so charges whose first row already reconciles (including unpaid charges) cost no extra API calls.
id 401286: -1.08 (chk 601601250977, PI).
Common failure reasons:
patient_not_found: no AdvancedMD patient matched the supplied name variations.charge_not_found: patients were found, but no transaction matched the date of service and CPT code.advancedmd_not_connected: AdvancedMD is not connected. The agent should ask the user to either connect AdvancedMD and try again, or stop the task.
Candidates on charge_not_found
An EOB date of service that disagrees with AdvancedMD’s is the top cause of false “charge not found” (production tasks escalated lines a human then matched by eye). When the patient matched but no charge hit the exact DOS + CPT, the response includes the same-CPT charges seen on other dates:
candidate_charges: up to 5 candidates across the scanned pages of all matched patients, nearest the requested DOS first — each withehr_charge_id,ehr_patient_id,ehr_visit_id,date_of_service,ehr_cpt_code,ehr_charge_amount,ehr_paid_amount,ehr_provider_code,ehr_carrier, andvoided. Voided charges appear only withinclude_voided_charges=trueand are flagged.message: tells the agent to verify the EOB DOS against the candidates before escalating the line.
Candidate <CPT> row per candidate. The reason stays charge_not_found — a candidate is a lead to verify (typically by re-running the lookup with the candidate’s DOS), never an automatic match.
Agent Instruction Guidance
When usingadvancedmd_find_charge in an agent workflow, explicitly state whether voided charges should be included.
Recommended default for EOB charge-matching workflows:
include_voided_charges = true only when the workflow specifically needs to inspect voided charges.
Example workflow instruction: