Skip to main content
Glama

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 }

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