Skip to main content
Glama

getObservationById

Retrieve specific observation data from a Medplum FHIR server using its unique ID for precise healthcare information access.

Instructions

Retrieves an observation by its unique ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
observationIdYesThe unique ID of the observation to retrieve.

Implementation Reference

  • The main handler function that authenticates, validates the observationId, and retrieves the Observation resource using medplum.readResource, returning null if not found.
    export async function getObservationById(args: GetObservationByIdArgs): Promise<Observation | null> { await ensureAuthenticated(); if (!args.observationId) { throw new Error('Observation ID is required to fetch an observation.'); } try { return await medplum.readResource('Observation', args.observationId); } catch (error: any) { if (error.outcome?.issue?.[0]?.code === 'not-found') { return null; } throw error; } }
  • TypeScript interface defining the input parameters for the getObservationById handler (observationId: string).
    export interface GetObservationByIdArgs { observationId: string; }
  • MCP tool schema defining the name, description, and inputSchema for validation in the ListTools and CallTool requests.
    { name: "getObservationById", description: "Retrieves an observation by its unique ID.", inputSchema: { type: "object", properties: { observationId: { type: "string", description: "The unique ID of the observation to retrieve.", }, }, required: ["observationId"], }, },
  • src/index.ts:38-43 (registration)
    Import statement bringing the getObservationById handler into the main index file for use in the MCP server.
    import { createObservation, getObservationById, updateObservation, searchObservations, } from './tools/observationUtils.js';
  • src/index.ts:968-971 (registration)
    Entry in the toolMapping object that registers 'getObservationById' to its handler function for execution during CallTool requests.
    createObservation, getObservationById, updateObservation, searchObservations,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rkirkendall/medplum-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server