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
Register the service at /.well-known/cds-services with hook: patient-view and declare a prefetch template for Patient and Condition
Accept the CDS Hooks request body (hook, hookInstance, context.patientId, prefetch) and validate the JWT bearer token from the EHR
Evaluate the prefetched data against care gap rules and build Card objects with summary, detail, indicator, and source fields
Return a JSON response with a cards array; omit the suggestions array when no actionable suggestion applies
Handle the case where prefetch data is absent by fetching the FHIR resources directly using the fhirAuthorization token
Return an empty cards array rather than an error when no gaps are found to avoid alert fatigue
Known gotchas
The prefetch template uses FHIR search URL syntax relative to the FHIR base; the EHR fills it before sending the request, so you cannot assume it is always populated
JWT validation must check iss, aud, and exp; the public key is retrieved from the EHR JWKS endpoint declared in the hook request jku header
Cards must not include PHI in the summary field if the card indicator is warning or critical, because summary may be logged by the EHR
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp