> ## Documentation Index
> Fetch the complete documentation index at: https://agents.nanonets.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# AdvancedMD Find Patient

> Native AdvancedMD patient search tool exposed through the Agents Platform.

This document covers `advancedmd_find_patient`, the native AdvancedMD patient search tool exposed through the Agents Platform.

## Authentication

AdvancedMD tools use the existing AdvancedMD connector. Users configure:

* `office_code`
* `username`
* `password`

The connector performs AdvancedMD's two-step API login, discovers the tenant API base URL, caches the security token, and refreshes it when needed.

## `advancedmd_find_patient`

Searches AdvancedMD for patients by name and/or date of birth using the `lookuppatient` API. This is a read-only lookup tool.

### Inputs

At least one of the following is required:

* `first_name`: Patient first name.
* `last_name`: Patient last name. Recommended for name searches — AdvancedMD matches on `Last, First`.
* `dob`: Date of birth in ISO-8601 format (`YYYY-MM-DD`). The tool converts this to AdvancedMD's `MM/DD/YYYY` format internally.

Optional:

* `exact_match`: Defaults to `false` for broader results. When `true`, AdvancedMD uses exact matching.
* `max_results`: Defaults to `25`. Maximum patients to return.
* `page`: Defaults to `1`. 1-based result page.

### Output

On success, structured content includes:

* `found: true`
* `count`: number of patients returned
* `patients`: array of matched AdvancedMD patient attribute maps (id, name, chart, dob, …)

Example shape:

```json theme={null}
{
  "found": true,
  "count": 1,
  "patients": [
    {
      "id": "pat123",
      "name": "TEST, SURAJ",
      "chart": "A1",
      "dob": "06/06/1999"
    }
  ]
}
```

Common results:

* `patient_not_found`: no AdvancedMD patient matched the supplied criteria (`found: false`).
* `advancedmd_not_connected`: AdvancedMD is not connected. The agent should ask the user to either connect AdvancedMD and try again, or stop the task.

## Agent Instruction Guidance

When searching for a specific patient, supply `last_name` plus `dob` for the most reliable single match. Use `first_name` to disambiguate when multiple patients share a last name.
