Skip to main content
Glama

getPractitionerById

Retrieve a healthcare practitioner's details using their unique ID with Medplum MCP Server, enabling quick access to practitioner resources for healthcare data management.

Instructions

Retrieves a practitioner resource by their unique ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
practitionerIdYesThe unique ID of the practitioner to retrieve.

Implementation Reference

  • Core handler function that authenticates, normalizes input to extract practitionerId, reads the Practitioner FHIR resource using Medplum.readResource, and handles not-found errors by returning null.
    export async function getPractitionerById(args: GetPractitionerByIdArgs | string): Promise<Practitioner | null> { await ensureAuthenticated(); // Handle both string and object parameter formats const practitionerId = typeof args === 'string' ? args : args.practitionerId; if (!practitionerId) { throw new Error('Practitioner ID is required to fetch a practitioner.'); } try { // No generic type needed, Medplum infers it from 'Practitioner' string return await medplum.readResource('Practitioner', practitionerId); } catch (error: any) { if (error.outcome?.issue?.[0]?.code === 'not-found') { return null; } throw error; } }
  • MCP protocol input schema defining the tool name, description, and required 'practitionerId' string parameter for validation in ListTools response.
    { name: "getPractitionerById", description: "Retrieves a practitioner resource by their unique ID.", inputSchema: { type: "object", properties: { practitionerId: { type: "string", description: "The unique ID of the practitioner to retrieve.", }, }, required: ["practitionerId"], }, },
  • TypeScript interface defining the input arguments for the handler function, requiring a 'practitionerId' string.
    export interface GetPractitionerByIdArgs { practitionerId: string; }
  • src/index.ts:13-19 (registration)
    Import statement registering the getPractitionerById handler function from practitionerUtils for use in the MCP server.
    import { searchPractitionersByName, createPractitioner, getPractitionerById, updatePractitioner, searchPractitioners, } from './tools/practitionerUtils.js';
  • src/index.ts:957-957 (registration)
    Maps the tool name 'getPractitionerById' to its handler function in the toolMapping object used for dynamic tool execution in CallToolRequestHandler.
    getPractitionerById,

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