Skip to main content
Glama

getOrganizationById

Retrieve detailed organization data by specifying its unique ID using Medplum MCP Server’s query tool for healthcare information management.

Instructions

Retrieves an organization by its unique ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organizationIdYesThe unique ID of the organization to retrieve.

Implementation Reference

  • Core implementation of the getOrganizationById tool handler. Fetches the Organization FHIR resource by ID using the Medplum client, supports both string ID and object args, gracefully handles not-found errors by returning null.
    * Retrieves an Organization resource by its ID. * @param args - The ID of the organization to retrieve. * @returns The Organization resource. */ export async function getOrganizationById(args: { organizationId: string } | string): Promise<Organization | null> { await ensureAuthenticated(); // Handle both string and object parameter formats const organizationId = typeof args === 'string' ? args : args.organizationId; if (!organizationId) { throw new Error('Organization ID is required to fetch an organization.'); } try { // Remove generic type, let Medplum infer it return await medplum.readResource("Organization", organizationId); } catch (error: any) { if (error.outcome?.issue?.[0]?.code === 'not-found') { return null; } throw error; } }
  • JSON schema definition for validating input parameters of the getOrganizationById tool.
    { name: 'getOrganizationById', description: 'Retrieves an organization by its unique ID.', input_schema: { type: 'object', properties: { organizationId: { type: 'string', description: 'The unique ID of the organization to retrieve.' }, }, required: ['organizationId'], }, },
  • src/index.ts:314-327 (registration)
    Registers the getOrganizationById tool in the MCP server's tool list (mcpTools), including name, description, and input schema for the ListTools request.
    { name: "getOrganizationById", description: "Retrieves an organization by its unique ID.", inputSchema: { type: "object", properties: { organizationId: { type: "string", description: "The unique ID of the organization to retrieve.", }, }, required: ["organizationId"], }, },
  • src/index.ts:20-25 (registration)
    Imports the getOrganizationById handler function from organizationUtils for use in the MCP server.
    import { createOrganization, getOrganizationById, updateOrganization, searchOrganizations, } from './tools/organizationUtils.js';
  • src/index.ts:961-961 (registration)
    Maps the tool name to its handler function in the toolMapping object used for execution.
    getOrganizationById,
  • TypeScript interface defining the expected arguments for the getOrganizationById function.
    export interface GetOrganizationByIdArgs { organizationId: string; }

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