> ## 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 Save Memo

> Patient chart-memo write tool exposed through the Agents Platform.

This document covers `advancedmd_save_memo`, the patient chart-memo write 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_save_memo`

Writes a memo (chart alert) onto an AdvancedMD patient record via the `savememo` API, so staff opening the chart see it. This is a **mutating** tool.

Memos are for short, actionable operational flags — "consent forms complete", "licensure check required". They are not clinical notes.

### Inputs

Required:

* `patient_id`: AdvancedMD patient id to attach the memo to, as returned by `advancedmd_find_patient`. This is the internal patient id, **not** the chart number shown in the AdvancedMD UI — passing a chart number fails with an "Invalid patient" fault.
* `memo_text`: Memo body. Keep it short; it renders as a chart alert.

Optional:

* `memo_type`: AdvancedMD memo type code. Defaults to `D` (display memo — a staff-visible chart alert), the same code `advancedmd_push_eligibility_results` uses for its memo writes.
* `timezone`: IANA timezone of the AdvancedMD office. The memo's `@created` date is written as the office-local date (AdvancedMD reads it as a wall clock) — a UTC worker would otherwise stamp tomorrow's date on evening memos for a US office. Defaults to `America/Los_Angeles`.
* `dry_run`: Defaults to `false` — the memo **is written** by default, matching the other AdvancedMD patient-write tools. Set `true` to preview the payload without calling AdvancedMD.

### Output

On success, structured content includes:

* `status`: `success` or `dry_run`
* `dry_run`: whether the write was skipped
* `patient_id`, `memo_type`, `memo_text`: what was written (or would have been)

### Notes

* There is **no idempotency**. Calling twice writes two memos. Callers that retry should check whether the memo already exists, or accept duplicates.
* AdvancedMD faults (e.g. an unknown patient id) surface as tool errors carrying the AdvancedMD fault string, not as Go errors, so the agent can react and retry.
* Prefixing memo text with a consistent identifier (e.g. `Nanonets:`) makes automation-written memos distinguishable from staff-written ones in the chart.
