Skip to main content
Glama
rkirkendall

Medplum MCP Server

by rkirkendall

updatePractitioner

Modify practitioner details in the Medplum MCP Server by providing the practitioner's unique ID and updated information, ensuring accurate healthcare data management.

Instructions

Updates an existing practitioner's information. Requires the practitioner's ID and the fields to update.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
activeNoUpdate active status.
practitionerIdYesThe unique ID of the practitioner to update.

Implementation Reference

  • Core handler function that fetches the existing Practitioner by ID, merges the provided partial updates (excluding resourceType and id), and performs the FHIR update using Medplum.
    export async function updatePractitioner(practitionerId: string, updates: UpdatePractitionerArgs): Promise<Practitioner> {
      await ensureAuthenticated();
    
      if (!practitionerId) {
        throw new Error('Practitioner ID is required to update a practitioner.');
      }
      if (!updates || Object.keys(updates).length === 0) {
        throw new Error('Updates object cannot be empty for updating a practitioner.');
      }
    
      const existingPractitioner = await medplum.readResource('Practitioner', practitionerId);
      if (!existingPractitioner) {
        throw new Error(`Practitioner with ID ${practitionerId} not found.`);
      }
      
      const { resourceType, id, ...safeUpdates } = updates as any; 
    
      const practitionerToUpdate: Practitioner = {
        ...existingPractitioner,
        ...safeUpdates,
        resourceType: 'Practitioner', 
        id: practitionerId, 
      };
      
      return medplum.updateResource(practitionerToUpdate);
    }
  • TypeScript interface defining the expected updates parameter, which is a partial Practitioner excluding resourceType and id.
    export interface UpdatePractitionerArgs extends Omit<Partial<Practitioner>, 'resourceType' | 'id'> {
      // Add simplified fields if LLM struggles with full FHIR structure
    }
  • src/index.ts:246-263 (registration)
    MCP tool registration including name, description, and simplified input schema for listTools response.
    {
      name: "updatePractitioner",
      description: "Updates an existing practitioner's information. Requires the practitioner's ID and the fields to update.",
      inputSchema: {
        type: "object",
        properties: {
          practitionerId: {
            type: "string",
            description: "The unique ID of the practitioner to update.",
          },
          active: {
            type: "boolean",
            description: "Update active status.",
          },
        },
        required: ["practitionerId"],
      },
    },
  • src/index.ts:958-958 (registration)
    Mapping of tool name to handler function in the toolMapping object used by the CallToolRequest handler.
    updatePractitioner,
  • src/index.ts:1023-1046 (registration)
    Shared execution logic in CallToolRequest handler that extracts practitionerId and updates from arguments and invokes the tool function for all update* tools.
     // Update tools that take ID and updates object
     const { patientId, practitionerId, organizationId, encounterId, observationId, medicationRequestId, medicationId, episodeOfCareId, conditionId, ...updates } = args;
     const id = patientId || practitionerId || organizationId || encounterId || observationId || medicationRequestId || medicationId || episodeOfCareId || conditionId;
     
              // Special handling for updateCondition
      if (toolName === 'updateCondition') {
        const updateArgs: any = { id };
        if ((updates as any).clinicalStatus) {
          const key = ((updates as any).clinicalStatus as string).toUpperCase() as keyof typeof ConditionClinicalStatusCodes;
          updateArgs.clinicalStatus = { coding: [ConditionClinicalStatusCodes[key]] };
        }
        if ((updates as any).verificationStatus) {
          const verStatusMap: { [key: string]: string } = { 'entered-in-error': 'ENTERED-IN-ERROR' };
          const key = (verStatusMap[(updates as any).verificationStatus] || ((updates as any).verificationStatus as string).toUpperCase()) as keyof typeof ConditionVerificationStatusCodes;
          updateArgs.verificationStatus = { coding: [ConditionVerificationStatusCodes[key]] };
        }
        if ((updates as any).onsetString !== undefined) {
          updateArgs.onsetString = (updates as any).onsetString;
        }
        result = await toolFunction(updateArgs);
      } else {
        result = await toolFunction(id, updates);
      }
    } else if (toolName === 'createCondition') {
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that it updates information and requires specific inputs, but fails to describe important behavioral aspects such as what happens if the practitioner ID doesn't exist, whether updates are partial or complete, permission requirements, or what the response contains. This leaves significant gaps for a mutation tool.

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?

The description is appropriately concise with two clear sentences that communicate the core functionality without unnecessary words. It's front-loaded with the main purpose, though it could be slightly more structured by separating requirements from the action description.

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 that this is a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what happens on success or failure, what fields can be updated beyond 'active' status, or how to handle errors. For a tool that modifies data, more contextual information is needed to use it effectively.

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?

The description mentions that it requires 'the practitioner's ID and the fields to update,' which aligns with the two parameters in the schema. However, with 100% schema description coverage, the schema already fully documents both parameters, so the description adds minimal value beyond what's already structured. It doesn't provide additional context about parameter interactions or usage examples.

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 verb ('Updates') and resource ('an existing practitioner's information'), making the purpose immediately understandable. It distinguishes from sibling tools like 'createPractitioner' by specifying it updates existing records rather than creating new ones, though it doesn't explicitly differentiate from other update tools like 'updatePatient' or 'updateCondition'.

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?

The description provides minimal guidance by stating it requires the practitioner's ID and fields to update, but offers no explicit advice on when to use this tool versus alternatives. It doesn't mention prerequisites, error conditions, or when to choose this over other update tools in the sibling list, leaving the agent without contextual usage 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