Skip to main content
Glama

Search FHIR Observations

search_observations
Read-onlyIdempotent

Search one patient's FHIR R4 Observation resources by code to retrieve vital signs or lab results, with read-only access and audited calls.

Instructions

Search FHIR R4 Observation resources for one patient filtered by a code, for example vital signs or lab results. Use it when you know the code to look for (LOINC is typical: http://loinc.org|8867-4 is heart rate); use get_patient to check the patient first. Read only. Returns a JSON array of Observations with status, code, subject, effective or issued time and the value, at most 200 results across up to 5 pages of 50; larger result sets fail instead of being truncated. Every call writes one hashed audit record. Other failures return the fixed text "FHIR request failed" with no server detail. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "patient_id": "<patient_id>",
      "code": "<code>"
    },
    "name": "search_observations"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesFHIR token search for Observation.code: system|code (http://loinc.org|8867-4), a bare code (8867-4), or several separated by commas. Letters, digits and - . | , : % / only.
patient_idYesFHIR logical id of the Patient, 1 to 64 letters, digits, dots or hyphens, for example a sandbox id returned by the FHIR server. Not a name, MRN or other identifier.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.5.0
    • addedInput schema / properties / code / description
      Added value: +"FHIR token search for Observation.code: system|code (http://loinc.org|8867-4), a bare code (8867-4), or several separated by commas. Letters, digits and - . | , : % / only."
    • addedInput schema / properties / patient_id / description
      Added value: +"FHIR logical id of the Patient, 1 to 64 letters, digits, dots or hyphens, for example a sandbox id returned by the FHIR server. Not a name, MRN or other identifier."
  2. First observedv0.4.0

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/idempotent/non-destructive, and the description goes well beyond them: it discloses the 200-result/5-page cap and that oversized result sets fail rather than truncate, that every call writes a hashed audit record, that errors collapse to the fixed text 'FHIR request failed', and that the patient policy check precedes any FHIR request and can return 'Patient access not authorized'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and scope are front-loaded, followed by usage, then return/limit behavior, then failure modes — a sensible ordering. It is dense with quoted error strings and audit details, but each sentence carries operational information rather than filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description still specifies the returned fields (status, code, subject, effective/issued time, value), pagination limits, and failure/auth behaviors. For a two-parameter read tool that is everything an agent needs to call it correctly and interpret the outcome.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3, but the description adds meaning: it gives a concrete LOINC token example (http://loinc.org|8867-4 is heart rate) and directs patient_id sourcing through get_patient, which the schema does not say. It does not explain multi-code comma behavior, which the schema handles.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource+scope: 'Search FHIR R4 Observation resources for one patient filtered by a code.' The scope (single patient, code-filtered) and the resource domain (Observation, not Medication or Patient) cleanly separate it from get_patient and get_medication_list.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Use it when you know the code to look for' gives a clear positive trigger, and 'use get_patient to check the patient first' names the prerequisite and the sibling to call beforehand. It stops short of explicit when-not guidance (e.g., what to do if the code is unknown), so it falls just short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.