Skip to main content
Glama

update_encounter

Modify existing patient encounter records in athenahealth by updating chief complaints, diagnosis codes, procedure codes, or encounter status for accurate clinical documentation.

Instructions

Update an existing encounter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encounter_idYesEncounter ID
chief_complaintNoChief complaint (optional)
diagnosis_codesNoComma-separated ICD-10 diagnosis codes (optional)
procedure_codesNoComma-separated CPT procedure codes (optional)
statusNoStatus: OPEN, CLOSED, SIGNED (optional)

Implementation Reference

  • The primary handler function executing the 'update_encounter' tool logic. Parses arguments, constructs update payload, invokes AthenaHealthClient, audits the action, and formats response as MCP content.
    async handleUpdateEncounter(args: any) {
      try {
        const encounterData = {
          chiefcomplaint: args.chief_complaint,
          diagnosiscodes: args.diagnosis_codes,
          procedurecodes: args.procedure_codes,
          status: args.status,
        };
    
        const encounter = await this.client.updateEncounter(args.encounter_id, encounterData);
    
        auditLog('ENCOUNTER_UPDATE', {
          resourceId: args.encounter_id,
          result: 'success',
          resourceType: 'ENCOUNTER',
        });
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify(encounter, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify({
                error: 'Failed to update encounter',
                message: error.message || 'Unknown error occurred',
                status: error.status || null,
                note: 'Encounter update may not be available in the athenahealth preview/sandbox environment.',
              }, null, 2),
            },
          ],
        };
      }
    }
  • Tool schema defining the 'update_encounter' name, description, and input validation schema.
    {
      name: 'update_encounter',
      description: 'Update an existing encounter',
      inputSchema: {
        type: 'object',
        properties: {
          encounter_id: { type: 'string', description: 'Encounter ID' },
          chief_complaint: { type: 'string', description: 'Chief complaint (optional)' },
          diagnosis_codes: { type: 'string', description: 'Comma-separated ICD-10 diagnosis codes (optional)' },
          procedure_codes: { type: 'string', description: 'Comma-separated CPT procedure codes (optional)' },
          status: { type: 'string', description: 'Status: OPEN, CLOSED, SIGNED (optional)' },
        },
        required: ['encounter_id'],
      },
    },
  • Registration in MCP server's call_tool request handler switch statement, dispatching 'update_encounter' to the appropriate tool handler.
    case 'update_encounter':
      return await this.toolHandlers.handleUpdateEncounter(args);
  • Supporting service method in EncounterService that performs the actual HTTP PUT request to Athenahealth API to update encounter details.
    async updateEncounter(encounterId: string, encounterData: {
      chiefcomplaint?: string;
      diagnosiscodes?: string;
      procedurecodes?: string;
      status?: string;
    }): Promise<Encounter> {
      const formData = new URLSearchParams();
      Object.entries(encounterData).forEach(([key, value]) => {
        if (value !== undefined && value !== null) {
          formData.append(key, String(value));
        }
      });
    
      const response = await this.makeRequest<AthenaHealthResponse<Encounter>>(
        `${this.config.practice_id}/encounters/${encounterId}`,
        {
          method: 'PUT',
          data: formData.toString(),
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
          },
        }
      );
      return response.data || response;
    }
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 states 'update' implies a mutation, but it doesn't disclose critical traits like required permissions, whether changes are reversible, side effects, or response format. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 extremely concise—a single, clear sentence with no wasted words. It's front-loaded with the core action, making it easy to parse quickly. This efficiency is ideal for a tool name that already implies its function.

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?

Given the complexity of a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't address behavioral aspects like permissions, side effects, or return values, which are crucial for safe and effective use. The high schema coverage helps with parameters, but overall context is lacking.

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?

Schema description coverage is 100%, so the input schema fully documents all parameters (encounter_id, chief_complaint, diagnosis_codes, procedure_codes, status). The description adds no additional meaning beyond what's in the schema, such as explaining parameter interactions or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Update an existing encounter' clearly states the action (update) and resource (encounter), but it's quite generic. It doesn't specify what aspects can be updated or differentiate it from sibling tools like 'get_encounter' or 'create_encounter' beyond the basic verb. While it's not tautological, it lacks the specificity needed for a higher score.

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. It doesn't mention prerequisites (e.g., needing an existing encounter ID), exclusions, or comparisons to siblings like 'create_encounter' or 'get_encounter'. Without such context, users must infer usage from the name alone, which is insufficient.

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