Launch a SMART app from a CDS Hooks card link action and pass hook context to the app so it can pre-populate clinical data without a redundant FHIR query

domain: cds-hooks.org · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. In the CDS Hooks card response, add a links array entry with type set to smart, url set to the SMART app launch URL, and appContext set to a JSON-serialized string containing the relevant hook context data such as the draft order resource ID, encounter ID, and any payer response data
  2. In the SMART app, parse the appContext parameter from the launch token after the EHR completes the SMART EHR launch handshake; the appContext is delivered as a claim in the launch token or as a query parameter depending on the EHR implementation
  3. Validate the appContext content before trusting it: verify that the resource IDs in appContext exist on the FHIR server using the access token obtained during the SMART launch, since appContext is EHR-supplied and may contain stale or invalid references
  4. Use the FHIR access token from the SMART launch to fetch the full resources referenced in appContext rather than accepting the appContext data as authoritative; the appContext is a hint, not a verified data payload
  5. Display the pre-populated data to the clinician immediately on app load using the appContext hints while background FHIR fetches complete, then update the display when the authoritative FHIR data arrives
  6. Handle the case where appContext is absent or malformed gracefully by falling back to standard FHIR queries using the patient and encounter context from the SMART launch token

Known gotchas

Related routes

Configure CDS Hooks prefetch templates with nested FHIR search URLs to supply a hook service with current medications and recent lab results without making additional FHIR calls during hook execution
cds-hooks.org · 6 steps · unrated
Implement a CDS Hooks patient-view service that fires when a patient chart opens, returns information cards with relevant gap-in-care alerts, and handles the prefetch template to avoid extra server round-trips
hl7.org/fhir/us/davinci-crd · 6 steps · unrated
Implement a CDS Hooks service that responds to order-select and order-sign hooks from an EHR to provide real-time clinical decision support cards with suggestions and links
hl7.org/fhir · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans