Escalate an appointment to the on-call provider
escalate_to_oncallMark an existing appointment as urgent and reassign it to the clinic's on-call provider, ensuring immediate attention for critical cases.
Instructions
Mark an existing appointment as urgent and reassign it to the clinic's on-call provider.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clinic_id | Yes | ||
| appointment_id | Yes | ||
| reason | Yes |
Implementation Reference
- src/tools/escalate-to-oncall.ts:21-51 (handler)Core handler function that escalates an appointment to the on-call provider: validates args, fetches appointment, finds on-call provider, updates appointment status to 'urgent' and reassigns provider, returns result with appointment, on-call provider info, and reassignment flag.
export function escalateToOncall( store: ClinicStore, raw: unknown, ): EscalateResult { const args = Args.parse(raw); const appointment = store.getAppointment(args.clinic_id, args.appointment_id); const oncall = store.findOnCallProvider(args.clinic_id); if (!oncall) { throw new ConflictError( `clinic ${args.clinic_id} has no on-call provider configured`, ); } const reassigned = appointment.provider_id !== oncall.id; const updated = store.updateAppointment(args.clinic_id, appointment.id, { status: "urgent", provider_id: oncall.id, reason: `${appointment.reason} | escalated: ${args.reason}`, }); return { appointment: updated, on_call_provider: { id: oncall.id, name: oncall.name, specialty: oncall.specialty, }, reassigned, }; } - src/tools/escalate-to-oncall.ts:6-10 (schema)Input schema for escalate_to_oncall tool: clinic_id (string), appointment_id (string), reason (string 1-500 chars).
export const escalateToOncallInput = { clinic_id: z.string(), appointment_id: z.string(), reason: z.string().min(1).max(500), }; - Output type definition for the escalate result: appointment, on_call_provider info, and reassigned boolean.
export interface EscalateResult { appointment: Appointment; on_call_provider: Pick<Provider, "id" | "name" | "specialty">; reassigned: boolean; - src/server.ts:94-103 (registration)Registration of the 'escalate_to_oncall' tool on the MCP server with title, description, input schema, and handler callback.
server.registerTool( "escalate_to_oncall", { title: "Escalate an appointment to the on-call provider", description: "Mark an existing appointment as urgent and reassign it to the clinic's on-call provider.", inputSchema: escalateToOncallInput, }, wrap((args) => escalateToOncall(store, args)), );