Skip to main content
Glama

create_prescription

Generate new prescriptions for patients by specifying medication details, dosage, frequency, and pharmacy information within athenahealth's clinical workflow.

Instructions

Create a new prescription for a patient

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patient_idYesPatient ID
medication_nameYesMedication name
dosageYesDosage (e.g., "10mg")
routeYesRoute of administration (e.g., "oral")
frequencyYesFrequency (e.g., "twice daily")
quantityYesQuantity to dispense
refillsYesNumber of refills
days_supplyYesDays supply
pharmacy_idNoPharmacy ID (optional)
notesNoAdditional notes (optional)

Implementation Reference

  • Executes the create_prescription tool: destructures args, maps to prescription data, calls AthenaHealthClient.createPrescription, audits success, returns JSON response or formatted error.
    async handleCreatePrescription(args: any) {
      try {
        const { patient_id, ...prescriptionData } = args;
        const prescription = await this.client.createPrescription(patient_id, {
          medicationname: prescriptionData.medication_name,
          dosage: prescriptionData.dosage,
          route: prescriptionData.route,
          frequency: prescriptionData.frequency,
          quantity: prescriptionData.quantity,
          refills: prescriptionData.refills,
          daysupply: prescriptionData.days_supply,
          pharmacyid: prescriptionData.pharmacy_id,
          notes: prescriptionData.notes,
        });
    
        auditLog('PRESCRIPTION_CREATE', {
          patientId: patient_id,
          result: 'success',
          resourceType: 'PRESCRIPTION',
        });
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify(prescription, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify({
                error: 'Failed to create prescription',
                message: error.message || 'Unknown error occurred',
                status: error.status || null,
                note: 'The prescription endpoint is not available in the athenahealth preview/sandbox environment. This endpoint requires a production API account.',
              }, null, 2),
            },
          ],
        };
      }
    }
  • Tool definition including name, description, and input schema specifying parameters and required fields for create_prescription.
    {
      name: 'create_prescription',
      description: 'Create a new prescription for a patient',
      inputSchema: {
        type: 'object',
        properties: {
          patient_id: { type: 'string', description: 'Patient ID' },
          medication_name: { type: 'string', description: 'Medication name' },
          dosage: { type: 'string', description: 'Dosage (e.g., "10mg")' },
          route: { type: 'string', description: 'Route of administration (e.g., "oral")' },
          frequency: { type: 'string', description: 'Frequency (e.g., "twice daily")' },
          quantity: { type: 'string', description: 'Quantity to dispense' },
          refills: { type: 'string', description: 'Number of refills' },
          days_supply: { type: 'string', description: 'Days supply' },
          pharmacy_id: { type: 'string', description: 'Pharmacy ID (optional)' },
          notes: { type: 'string', description: 'Additional notes (optional)' },
        },
        required: ['patient_id', 'medication_name', 'dosage', 'route', 'frequency', 'quantity', 'refills', 'days_supply'],
      },
    },
  • Dispatch in the CallToolRequestHandler switch statement that routes 'create_prescription' calls to the tool handler.
    case 'create_prescription':
      return await this.toolHandlers.handleCreatePrescription(args);
  • Registers the list of available tools, including create_prescription schema from toolDefinitions.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools: toolDefinitions };
    });

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/ophydami/Athenahealth-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server