Construct a Cross-Gateway Query (ITI-38) request as a standard XDS AdhocQueryRequest but addressed to the Initiating Gateway endpoint rather than a local registry
Include the homeCommunityId attribute on the AdhocQueryRequest to indicate the target community, or omit it to allow the Initiating Gateway to fan the query to all known Responding Gateways
The Initiating Gateway forwards the query to each Responding Gateway's ITI-38 endpoint and aggregates the RegistryObjectList responses
Inspect the returned ExtrinsicObjects for the homeCommunityId attribute on each entry — this identifies which community holds the document
Issue a Cross-Gateway Retrieve (ITI-39) targeting the appropriate Responding Gateway, supplying DocumentRequest elements that each include homeCommunityId, repositoryUniqueId, and documentUniqueId
Known gotchas
Each Responding Gateway may enforce its own patient identity requirements — the patient must be known to the remote community (often via XCPD prior to the query) or the gateway will return zero results without an error
Network latency across gateways means ITI-38 responses can be significantly slower than local registry queries; callers should apply a generous timeout and handle partial responses where some gateways respond and others time out
The homeCommunityId returned in query results is the Responding Gateway's community OID, not the Initiating Gateway's — use this value verbatim in the ITI-39 retrieve request
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