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; }

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