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 };
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'Create' which implies a write operation, but fails to specify critical details like required permissions, whether it's idempotent, error handling, or what the response contains (e.g., prescription ID). This leaves significant gaps for an AI agent.

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 a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's front-loaded and wastes no space, making it easy for an AI agent to parse quickly.

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 tool with 10 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain behavioral aspects like side effects, authorization needs, or return values, leaving the AI agent with incomplete context for safe and effective use.

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?

The schema description coverage is 100%, with all parameters clearly documented in the schema itself (e.g., 'dosage' described as 'Dosage (e.g., "10mg")'). The description adds no additional parameter information beyond what's in the schema, so it meets the baseline score of 3 for high schema coverage.

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 ('Create') and resource ('a new prescription for a patient'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'create_appointment' or 'create_patient' beyond the resource name, which is why it doesn't reach a score of 5.

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 no guidance on when to use this tool versus alternatives like 'check_drug_interactions' or 'create_encounter', nor does it mention prerequisites such as needing an existing patient record. It simply states what the tool does without context for 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

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