Skip to main content
Glama
rkirkendall

Medplum MCP Server

by rkirkendall

updateOrganization

Modify an organization's details in the Medplum MCP Server by providing its unique ID and updating fields such as name or aliases.

Instructions

Updates an existing organization. Requires the organization ID and the fields to update.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasNoAn updated list of aliases. Optional.
nameNoThe new official name of the organization. Optional.
organizationIdYesThe unique ID of the organization to update.

Implementation Reference

  • The core handler function that performs the organization update logic: authenticates, validates inputs, reads existing resource, merges updates safely, and updates via Medplum.
    /**
     * Updates an existing Organization resource.
     * @param organizationId - The ID of the organization to update.
     * @param updates - The partial data to update the organization with.
     * @returns The updated Organization resource.
     */
    export async function updateOrganization(organizationId: string, updates: UpdateOrganizationArgs): Promise<Organization> {
      await ensureAuthenticated();
    
      if (!organizationId) {
        throw new Error('Organization ID is required to update an organization.');
      }
      if (!updates || Object.keys(updates).length === 0) {
        throw new Error('Updates object cannot be empty for updating an organization.');
      }
    
      const existingOrganization = await medplum.readResource("Organization", organizationId);
      if (!existingOrganization) {
        throw new Error(`Organization with ID ${organizationId} not found.`);
      }
    
      const { resourceType, id, ...safeUpdates } = updates as any;
    
      const organizationToUpdate: Organization = {
        ...existingOrganization,
        ...safeUpdates,
        resourceType: "Organization",
        id: organizationId,
      };
    
      return medplum.updateResource(organizationToUpdate);
    }
  • JSON Schema definition for the updateOrganization tool input, specifying parameters like organizationId, name, alias.
    {
      name: 'updateOrganization',
      description: "Updates an existing organization. Requires the organization ID and the fields to update.",
      input_schema: {
        type: 'object',
        properties: {
          organizationId: { type: 'string', description: "The unique ID of the organization to update." },
          name: { type: 'string', description: "The new official name of the organization. Optional." },
          alias: { type: 'array', items: { type: 'string' }, description: "An updated list of aliases. Optional." },
          // Add other updatable fields from UpdateOrganizationArgs as simplified properties for LLM
          // Example: contact, address - keeping them simple for LLM
        },
        required: ['organizationId'], // At least one update field implied
      },
    },
  • src/index.ts:328-350 (registration)
    Tool registration in MCP server: schema included in mcpTools array used by the server.
    {
      name: "updateOrganization",
      description: "Updates an existing organization. Requires the organization ID and the fields to update.",
      inputSchema: {
        type: "object",
        properties: {
          organizationId: {
            type: "string",
            description: "The unique ID of the organization to update.",
          },
          name: {
            type: "string",
            description: "The new official name of the organization. Optional.",
          },
          alias: {
            type: "array",
            items: { type: "string" },
            description: "An updated list of aliases. Optional.",
          },
        },
        required: ["organizationId"],
      },
    },
  • src/index.ts:21-25 (registration)
    Import of the updateOrganization handler function for use in the MCP tool mapping.
      createOrganization,
      getOrganizationById,
      updateOrganization,
      searchOrganizations,
    } from './tools/organizationUtils.js';
  • src/index.ts:962-962 (registration)
    Mapping of 'updateOrganization' string key to the imported handler function in toolMapping object used for execution.
    updateOrganization,
  • TypeScript interface defining the shape of updates accepted by the updateOrganization handler.
    export interface UpdateOrganizationArgs extends Omit<Partial<Organization>, 'resourceType' | 'id'> {
      // if specific simplified fields are needed, they can be added here
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Updates' implies mutation, it doesn't describe what happens to unspecified fields (partial vs. full update), whether changes are reversible, what permissions are required, error conditions, or response format. For a mutation tool with zero annotation coverage, this leaves critical behavioral aspects undocumented.

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 extremely concise - a single sentence that gets straight to the point with no wasted words. It's front-loaded with the core purpose and includes essential requirements. Every word serves a clear purpose, making it efficient for quick comprehension.

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?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns, error handling, permission requirements, or behavioral nuances. Given the complexity of updating organizational data and the lack of structured metadata, the description should provide more complete operational context.

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%, providing complete parameter documentation. The description adds minimal value beyond schema - it mentions 'organization ID and the fields to update' but doesn't elaborate on parameter relationships, constraints, or usage patterns. With comprehensive schema coverage, baseline 3 is appropriate as the description doesn't significantly enhance parameter understanding.

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 organization'), making the purpose immediately understandable. It distinguishes from sibling 'createOrganization' by specifying 'existing' rather than new creation. However, it doesn't differentiate from other update tools like 'updateCondition' or 'updatePatient' beyond the resource type.

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 - only stating that it requires organization ID and fields to update. It doesn't specify when to use this vs. other update tools (like updateCondition), doesn't mention prerequisites or permissions needed, and offers no alternatives or exclusions. The guidance is basic and insufficient for informed tool selection.

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