# search_patient

URL: https://docs.clinia.com/api/mcp/tools/search-patient

> Keyword search over a patient's clinical facts, timeline events and source documents.

Searches a patient's clinical facts (conditions, medications, allergies and the rest of the [virtual file tree](https://docs.clinia.com/docs/context-assembly/virtual-file-system)'s entries), timeline events and source documents by keyword. Use it when the agent knows a term but not the path.

## Input [#input]

| Argument     | Type   | Required | Description                                                                                                  |
| ------------ | ------ | -------- | ------------------------------------------------------------------------------------------------------------ |
| `patient_id` | string | Yes      | The patient's `patientId`. See [Shared arguments](https://docs.clinia.com/api/mcp/server#shared-arguments).                         |
| `query`      | string | Yes      | Search terms, such as `metformin` or `kidney function`.                                                      |
| `session_id` | string | No       | A session to record the call on. See [Record calls on a session](https://docs.clinia.com/api/mcp/server#record-calls-on-a-session). |

A result must contain every term in `query`. Matching is on English word stems, so `medications` matches `medication`.

## Output [#output]

Up to 20 matches, best first, as a Markdown list. Each entry is a path, then its preview on the next line.

```json title="Input"
{ "patient_id": "abc", "query": "metformin" }
```

```md title="Output"
- /medications/active/fct_h7r2c9x4m1p8q5v3n6b0z2w4
  metformin, oral (active)
```

Paths are relative to the patient, the form [`read_patient`](https://docs.clinia.com/api/mcp/tools/read-patient) and [`browse_patient`](https://docs.clinia.com/api/mcp/tools/browse-patient) take.

When nothing matches, `No results for "{query}".`
