Skip to main content
Glama

check_appointment_availability

Find available appointment slots for a specific department within a date range to schedule patient visits efficiently.

Instructions

Check available appointment slots for a department and date range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
department_idYesDepartment ID
provider_idNoProvider ID (optional - leave empty to check all providers)
appointment_typeNoAppointment type (optional)
start_dateYesStart date (YYYY-MM-DD)
end_dateYesEnd date (YYYY-MM-DD)

Implementation Reference

  • The primary MCP tool handler function that processes the tool call, extracts parameters, calls the service client, and formats the response as MCP content.
    async handleCheckAppointmentAvailability(args: any) { try { const { department_id, provider_id, appointment_type, start_date, end_date } = args; const availability = await this.client.getAppointmentAvailability({ departmentid: department_id, providerid: provider_id, appointmenttype: appointment_type, startdate: start_date, enddate: end_date, }); return { content: [ { type: 'text' as const, text: JSON.stringify(availability, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: 'text' as const, text: JSON.stringify({ error: 'Failed to check appointment availability', message: error.message || 'Unknown error occurred', details: error.details || error.message, note: 'This endpoint may not be available in the preview/sandbox environment', }, null, 2), }, ], }; } }
  • The input schema and metadata definition for the check_appointment_availability tool, used for validation and tool listing.
    { name: 'check_appointment_availability', description: 'Check available appointment slots for a department and date range', inputSchema: { type: 'object', properties: { department_id: { type: 'string', description: 'Department ID' }, provider_id: { type: 'string', description: 'Provider ID (optional - leave empty to check all providers)' }, appointment_type: { type: 'string', description: 'Appointment type (optional)' }, start_date: { type: 'string', description: 'Start date (YYYY-MM-DD)' }, end_date: { type: 'string', description: 'End date (YYYY-MM-DD)' }, }, required: ['department_id', 'start_date', 'end_date'], }, },
  • Tool dispatch registration in the MCP server's CallToolRequest handler switch statement.
    case 'check_appointment_availability': return await this.toolHandlers.handleCheckAppointmentAvailability(args);
  • Supporting service method that performs the actual HTTP request to the Athenahealth API /appointments/open endpoint to retrieve available slots.
    async getAppointmentAvailability(params: { departmentid: string; startdate: string; enddate: string; providerid?: string; appointmenttype?: string; }): Promise<any[]> { try { const response = await this.makeRequest<any>( `${this.config.practice_id}/appointments/open`, { method: 'GET', params, } ); if (response.appointments && Array.isArray(response.appointments)) { return response.appointments; } if (Array.isArray(response)) { return response; } if (response.data && Array.isArray(response.data)) { return response.data; } return []; } catch (error: any) { console.error('Get appointment availability error:', error.message); throw error; } }

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