Skip to main content
Glama

getMedicationRequestById

Retrieve specific medication request details using its unique ID on the Medplum MCP Server. Provides quick access to essential healthcare data for efficient management.

Instructions

Retrieves a medication request by its unique ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
medicationRequestIdYesThe unique ID of the medication request to retrieve.

Implementation Reference

  • The main handler function that authenticates, validates the medicationRequestId, and retrieves the MedicationRequest resource using medplum.readResource, returning null if not found.
    /** * Retrieves a MedicationRequest by its ID. * @param args - The arguments containing the medication request ID. * @returns The MedicationRequest resource, or null if not found. */ export async function getMedicationRequestById(args: GetMedicationRequestByIdArgs): Promise<MedicationRequest | null> { await ensureAuthenticated(); if (!args.medicationRequestId) { throw new Error('MedicationRequest ID is required to fetch a medication request.'); } try { return await medplum.readResource('MedicationRequest', args.medicationRequestId); } catch (error: any) { if (error.outcome?.issue?.[0]?.code === 'not-found') { return null; } throw error; } }
  • TypeScript interface defining the input parameters for the getMedicationRequestById handler.
    // Interface for retrieving a MedicationRequest by ID export interface GetMedicationRequestByIdArgs { medicationRequestId: string; }
  • MCP tool schema definition including name, description, and input schema for validation in the MCP server.
    name: "getMedicationRequestById", description: "Retrieves a medication request by its unique ID.", inputSchema: { type: "object", properties: { medicationRequestId: { type: "string", description: "The unique ID of the medication request to retrieve.", }, }, required: ["medicationRequestId"], }, },
  • src/index.ts:973-973 (registration)
    Registration of the getMedicationRequestById handler function in the toolMapping object used by the MCP server's CallToolRequest handler.
    getMedicationRequestById,
  • src/index.ts:45-48 (registration)
    Import statement that brings the getMedicationRequestById function into the index module for registration.
    createMedicationRequest, getMedicationRequestById, updateMedicationRequest, searchMedicationRequests,

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