POST /Library/$cql (or the server-specific endpoint such as /cql/evaluate) with a Parameters resource containing a subject parameter (Patient reference) and expression parameters with inline CQL text
Alternatively, POST with a library parameter referencing an existing Library canonical and an expression parameter naming a specific expression to evaluate
Review the returned Parameters resource; each result parameter corresponds to one evaluated expression and contains the result value, type, and any encountered errors
Use $cql iteratively during measure development to validate individual population expressions against specific patients before assembling a full Measure
Confirm the server supports the $cql operation by checking the CapabilityStatement or the cqf-ruler /cql/evaluate endpoint documentation
Known gotchas
The $cql operation is defined in the Clinical Reasoning module and the cqf-ruler implementation; not all FHIR servers support it — it may be absent from standard HAPI FHIR without the clinical reasoning plugin
Inline CQL passed to $cql must include a complete library header and using declaration; submitting expression-only fragments without a library context will fail to resolve FHIR model paths
Results from $cql are point-in-time; if patient data changes on the server between calls, expressions may return different results — important when debugging apparent inconsistencies
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