Skip to main content
Glama

getEpisodeOfCareById

Retrieve healthcare episode details using a unique ID to access and manage patient care data efficiently on Medplum MCP Server.

Instructions

Retrieves an episode of care by its unique ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
episodeOfCareIdYesThe unique ID of the episode of care to retrieve.

Implementation Reference

  • Core handler function that implements the tool logic: reads EpisodeOfCare resource by ID from Medplum, handles not-found as null, errors as OperationOutcome.
    export async function getEpisodeOfCareById( episodeOfCareId: string, client?: MedplumClient, ): Promise<EpisodeOfCare | null | OperationOutcome> { const medplumClient = client || medplum; await ensureAuthenticated(); try { if (!episodeOfCareId) { throw new Error('EpisodeOfCare ID is required.'); } const result = (await medplumClient.readResource( 'EpisodeOfCare', episodeOfCareId, )) as EpisodeOfCare | null; console.log(result ? 'EpisodeOfCare retrieved:' : 'EpisodeOfCare not found:', episodeOfCareId); return result; } catch (error: any) { if (error.outcome && error.outcome.issue && error.outcome.issue[0]?.code === 'not-found') { console.log(`EpisodeOfCare with ID "${episodeOfCareId}" not found.`); return null; } const outcome: OperationOutcome = { resourceType: 'OperationOutcome', issue: [ { severity: 'error', code: 'exception', diagnostics: `Error retrieving EpisodeOfCare: ${error.message || 'Unknown error'}`, }, ], }; if (error.outcome) { return error.outcome as OperationOutcome; } return outcome; } }
  • Input schema definition for the tool used in MCP server tool list.
    name: "getEpisodeOfCareById", description: "Retrieves an episode of care by its unique ID.", inputSchema: { type: "object", properties: { episodeOfCareId: { type: "string", description: "The unique ID of the episode of care to retrieve.", }, }, required: ["episodeOfCareId"], }, },
  • src/index.ts:980-980 (registration)
    Maps the tool name to the handler function in the tool execution dispatcher.
    getEpisodeOfCareById,
  • src/index.ts:56-60 (registration)
    Imports the handler function for use in the MCP server.
    createEpisodeOfCare, getEpisodeOfCareById, updateEpisodeOfCare, searchEpisodesOfCare, } from './tools/episodeOfCareUtils.js';
  • Legacy or additional schema definition for the tool (possibly not actively used).
    name: 'getEpisodeOfCareById', description: 'Retrieves a specific EpisodeOfCare resource by its ID.', input_schema: { type: 'object', properties: { episodeOfCareId: { type: 'string', description: 'The unique ID of the EpisodeOfCare to retrieve.' } }, required: ['episodeOfCareId'] } },

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