Identify the ValueSet by its canonical URL or logical ID on the terminology server
POST to ValueSet/$validate-code with Parameters containing the code, system (LOINC system URI), and the url of the target ValueSet
Parse the response Parameters for the 'result' boolean and the 'message' string explaining any validation failure
If validation fails, call ValueSet/$expand to retrieve the full expansion and inspect member codes to identify the closest correct code
Cache validation results keyed by code and ValueSet version to avoid redundant terminology server calls
Known gotchas
The LOINC system URI must be used exactly as defined in the FHIR specification; using a variation or omitting the system causes the server to treat the code as context-free and it may return an incorrect result
$validate-code against a large intensional ValueSet (one defined by filters rather than enumerated codes) may be slow or unsupported; some servers require $expand first and validate client-side
ValueSet version must be specified if the validation must be reproducible; omitting the version means the server uses its current version, which may change over time
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