Query a FHIR server using _revinclude to fetch Provenance resources that reference returned resources, and interpret provenance to trace the origin and chain of custody of clinical data
Add _revinclude=Provenance:target to a FHIR search query to instruct the server to include Provenance resources that target any resource in the search result set
Parse the returned Bundle for entries with search.mode=include to identify the Provenance resources, then match each Provenance.target reference to its corresponding resource in the bundle
Extract agent elements from each Provenance resource to identify who acted on the data: agent.who references practitioners or organizations, and agent.onBehalfOf captures delegated actions
Examine Provenance.activity.coding to classify the action (e.g., CREATE, UPDATE, TRANSFORM, VERIFY) and Provenance.entity to identify source resources that were used to derive the target
Use Provenance.recorded timestamp and Provenance.occurredDateTime to reconstruct the audit trail timeline for a given clinical resource
Known gotchas
Not all FHIR servers populate Provenance resources automatically; many require the writing application to explicitly submit Provenance alongside data, so absence of Provenance does not mean absence of history
_revinclude is processed per page of results; when paginating, each page independently includes only the Provenance records for that page's resources, so you must process includes page by page
Provenance chaining (deriving from another Provenance) is allowed in FHIR but infrequently implemented; do not assume a single Provenance record captures the full history of a derived resource
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