The Context Engine Studio is now open source.  View on GitHub →

Read a Condition Story

Read _story.md via MCP tool or REST, and choose the right format and token budget for your use case.

A condition story is a pre-assembled Markdown narrative for a single clinical condition. It combines onset, current medications, monitoring labs, and complications from the knowledge graph into a single document, so an agent can get full context in one read.

Find the condition

Browse the active conditions to get the condition's id:

bash
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/{patientId}/vfs?path=/conditions/active" \
  -H "Authorization: Bearer <access-token>"

Each child has a name, the condition's id such as fct_k3v9q2m7x1c8b5n4z6w0a2d1, and a display, its readable name. Pick the condition by its display and use its name as {condition} in the paths below.

Read via REST

bash
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/{patientId}/read?path=/conditions/active/{condition}/_story.md" \
  -H "Authorization: Bearer <access-token>"

The response is { "content": "..." } where content is the Markdown narrative.

Read via MCP tool

plaintext
read_patient(
  path = "/patient/{patientId}/conditions/active/{condition}/_story.md"
)

Choosing a format

Pass format to control verbosity. Default is narrative.

FormatContentTypical tokensWhen to use
narrativeFull Markdown, one section per kind of related record300–800Agent needs complete clinical context
structuredJSON of _story.md: status, codes, onset and related records by id200–500Downstream processing or structured extraction
compactOne line: the condition's name, status and onset10–30Scanning many conditions before selecting one to read in full
bash
# Compact format
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/{patientId}/read?path=/conditions/active/{condition}/_story.md&format=compact" \
  -H "Authorization: Bearer <access-token>"

# Structured format
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/{patientId}/read?path=/conditions/active/{condition}/_story.md&format=structured" \
  -H "Authorization: Bearer <access-token>"

Setting a token budget

Pass token_budget to cap response length. The story is rendered in full and then cut from the end — there is no per-section prioritiser — so a budget keeps as much of this order as fits:

  1. Status, onset, and codes
  2. Progression timeline
  3. Medications, by status
  4. Monitoring labs
  5. Complications and related conditions
  6. Encounters
  7. Patient-reported memories
  8. Links to the source narratives
bash
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/{patientId}/read?path=/conditions/active/{condition}/_story.md&token_budget=300" \
  -H "Authorization: Bearer <access-token>"

One token ≈ 4 characters. A budget of 300 gives roughly a paragraph-length narrative. Omit token_budget for no limit. A budget applies to narrative and compact; a structured read with one is rejected with 400.

What a story contains

A full narrative story includes:

  • Status, onset and codes: the condition's status, the day it started, the clinical knowledge base concept it maps to, and its SNOMED, ICD-10 or other codes from all sources
  • Progression: the onset, then each other day a source recorded the condition
  • Active medications: medications with a prescribed_for relationship to this condition, with their dosage and the reasoning behind the link
  • On-hold, completed, discontinued and unknown-status medications: the same relationship to medications that are not active, each status under its own heading, with the period they covered
  • Monitoring: results with a monitors relationship to this condition, by date
  • Complications and related conditions: conditions tied to this one by has_complication or a related-condition relationship, each linking to its own story
  • Encounters: the visits that addressed the condition, each linking to its file under /encounters/
  • Patient-Reported: what the patient said that corroborates, conflicts with or adds to the record
  • Narratives: a link to each narrative a verification verdict ties to this condition, under _narratives/, with the verdicts it holds (corroborates, enriches, conflicts). Last in the document, so it is the first section a token_budget drops, and absent when nothing links to the condition. compact omits it.

The links to medications, results and other conditions come from the clinical knowledge base. They are not extracted directly from the source records.

Read the structured entity

For machine-readable fields without the narrative formatting, read _story.md with format=structured:

bash
curl "https://<workspace-id>.w.clinia.cloud/v1/patients/{patientId}/read?path=/conditions/active/{condition}/_story.md&format=structured" \
  -H "Authorization: Bearer <access-token>"

See Condition Stories for a full explanation of how stories are assembled.

On this page