Skip to main content
Glama
rkirkendall

Medplum MCP Server

by rkirkendall

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,
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it retrieves by ID without disclosing behavioral traits like error handling, permissions needed, or response format. It's vague and lacks essential operational details.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words, clearly front-loading the core action. It's appropriately sized for a simple retrieval tool.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain return values, error cases, or behavioral aspects, leaving gaps for a tool that might involve data retrieval complexities.

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 description coverage is 100%, so the parameter 'practitionerId' is well-documented in the schema. The description adds no additional meaning beyond what the schema provides, meeting the baseline for high coverage.

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

Purpose4/5

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

The description clearly states the action ('Retrieves') and resource ('practitioner resource'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'getPatientById' or 'getOrganizationById' beyond specifying the resource type, missing explicit distinction.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives such as 'searchPractitioners' or 'searchPractitionersByName'. The description lacks context about prerequisites or specific use cases, offering minimal direction.

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

Install Server

Other Tools

Related Tools

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