Skip to main content
Glama

Get Encounters

get_encounters
Read-onlyIdempotent

Lists a patient's FHIR R4 Encounter resources (visits and admissions), with an optional since date to narrow long histories. Read-only, access-checked, and audit-logged with hashed patient IDs.

Instructions

List FHIR R4 Encounter resources (visits and admissions) for one patient. Pass since (YYYY-MM-DD) for patients with a long history. Returns a JSON array with status, class, type and period. Read only. Every call writes one audit record in which the patient id is HMAC-hashed; no PHI is logged. Access is checked first against the server patient policy: a patient outside the caller grant returns "Patient access not authorized" before any FHIR request. More than 200 results returns "Too many results (more than 200); narrow the request". Other failures return "FHIR request failed" with no server detail.

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>"
    },
    "name": "get_encounters"
  }
}

Input Schema

NameRequiredDescriptionDefault
sinceNoOptional start date, YYYY-MM-DD. Only encounters on or after this date are returned; use it when a patient has a long history.
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. Addedv0.7.1

TDQS

A4/5.0
Behavior4/5

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

Goes well beyond the annotations (which only cover readOnly/idempotent/non-destructive/openWorld) by disclosing an audit record per call with an HMAC-hashed patient id, no PHI logging, the ordering of the patient-access policy check, and the exact error strings for unauthorized patients, the 200-result cap, and generic FHIR failures. This is strong behavioral context; only the pagination/truncation semantics beyond the 200 cap remain unstated.

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 is front-loaded in the first sentence, followed by parameter hint, return shape, and failure modes in a logical order. The enumerated error strings are verbose but operationally useful, so nearly every sentence earns its place.

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 supplies the return shape (JSON array with status, class, type, period) plus the result cap, authorization pre-check, and the exact failure messages an agent must handle. That is complete for a two-parameter read tool.

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

Parameters3/5

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

Schema coverage is 100% and both parameters are already documented in the schema, including the YYYY-MM-DD format. The description repeats the 'since for long history' hint and adds only the indirect connection to the 200-result limit, so it contributes little meaning beyond structured data — the baseline 3.

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 ('List') and resource ('FHIR R4 Encounter resources (visits and admissions)') with an explicit scope: 'for one patient'. The resource type alone separates it from siblings like get_conditions or get_allergies, and the patient scope separates it from population-level searches.

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

Usage Guidelines3/5

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

Gives conditional guidance for the optional parameter ('Pass since (YYYY-MM-DD) for patients with a long history') but never says when to choose this tool over the sibling resource tools, nor any exclusion criteria. Usage is implied by the resource type rather than spelled out.

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