Clinia
How-to Guides

Search Patient Data

Use the search_patient MCP tool to find entities, events, and narrative content by keyword.

Where to start

Patient Memory maintains a BM25 full-text index over all ingested patient data. The index covers entity display names, clinical codes, attribute text, and narrative section content. Search is available via the search_patient MCP tool.

Make the call

search_patient(
  patientId = "{patientId}",
  query     = "{query}"
)

Query patterns

Single term (matches entity names, codes, and attribute values):

search_patient(patientId = "{patientId}", query = "metformin")

Multi-term (BM25 ranks results by combined term frequency across all indexed fields):

search_patient(patientId = "{patientId}", query = "diabetes kidney")

Code search (SNOMED, ICD-10, LOINC, and RxNorm codes are indexed):

search_patient(patientId = "{patientId}", query = "E11.9")

Phrase in narratives (condition story content is indexed, so you can find concepts mentioned in pre-assembled narratives):

search_patient(patientId = "{patientId}", query = "eGFR below target")

Interpreting results

Results are returned as an array of matches ordered by relevance score:

[
  {
    "path": "/patient/123/medications/current/metformin_1000mg",
    "preview": "Metformin 1000mg BID - active since 2016-04"
  },
  {
    "path": "/patient/123/conditions/active/type_2_diabetes_mellitus/_story.md",
    "preview": "...metformin is the primary medication for this condition..."
  }
]

Each result includes:

  • path: the VFS path of the matching item. Pass this directly to read_patient to retrieve the full content.
  • preview: a short excerpt showing why the item matched.

Agent workflow

Search is most useful when the agent doesn't know the exact VFS path. A typical pattern:

  1. search_patient with a keyword to get candidate paths
  2. read_patient on the most relevant path to get full content
  3. Repeat for additional context if needed

Prefer browse_patient when the agent knows the category it wants (e.g. "list active conditions"). Use search when the agent knows a term but not where in the VFS it lives.

On this page