/opt/mawid/apps/api/src/agent
Edit: /opt/mawid/apps/api/src/agent/tool-definitions.ts (3614B)
/**
* Tool schemas exposed to Claude (PROJECT_PLAN Phase 3). patientId/clinicId are
* never model-provided — they come from the conversation context server-side.
*/
export const AGENT_TOOLS = [
{
name: 'get_services',
description: "List the clinic's bookable services with duration and price.",
input_schema: { type: 'object' as const, properties: {}, required: [] },
},
{
name: 'get_availability',
description:
'Get free appointment slots for a service. Optionally filter by staff member and date range (clinic-local dates, max 14 days). Never invent slots — only offer what this returns.',
input_schema: {
type: 'object' as const,
properties: {
serviceId: { type: 'string', description: 'Service id from get_services' },
staffId: { type: 'string', description: 'Optional staff id to filter by' },
fromDate: { type: 'string', description: 'Start date YYYY-MM-DD (clinic-local), default today' },
toDate: { type: 'string', description: 'End date YYYY-MM-DD inclusive, default fromDate+7d' },
},
required: ['serviceId'],
},
},
{
name: 'create_appointment',
description:
'Book a slot for the patient. Only call after the patient explicitly confirmed service, staff, date and time. Use startsAtUtc exactly as returned by get_availability.',
input_schema: {
type: 'object' as const,
properties: {
serviceId: { type: 'string' },
staffId: { type: 'string' },
startsAtUtc: { type: 'string', description: 'ISO timestamp from get_availability' },
},
required: ['serviceId', 'staffId', 'startsAtUtc'],
},
},
{
name: 'reschedule_appointment',
description:
'Move an existing appointment to a new slot. Use newStartsAtUtc exactly as returned by get_availability.',
input_schema: {
type: 'object' as const,
properties: {
appointmentId: { type: 'string' },
newStartsAtUtc: { type: 'string' },
},
required: ['appointmentId', 'newStartsAtUtc'],
},
},
{
name: 'cancel_appointment',
description: "Cancel the patient's appointment.",
input_schema: {
type: 'object' as const,
properties: {
appointmentId: { type: 'string' },
reason: { type: 'string', description: 'Optional short reason' },
},
required: ['appointmentId'],
},
},
{
name: 'add_to_waitlist',
description:
'Put the patient on the waitlist for a service when no suitable slot exists. preferredWindow describes when they can come.',
input_schema: {
type: 'object' as const,
properties: {
serviceId: { type: 'string' },
preferredWindow: {
type: 'object',
description: 'e.g. {"fromDate":"2026-07-20","toDate":"2026-07-25","note":"afternoons"}',
properties: {
fromDate: { type: 'string' },
toDate: { type: 'string' },
note: { type: 'string' },
},
},
},
required: ['serviceId'],
},
},
{
name: 'get_patient_appointments',
description: "List the patient's upcoming appointments.",
input_schema: { type: 'object' as const, properties: {}, required: [] },
},
{
name: 'handoff_to_human',
description:
'Flag this conversation for the clinic owner and stop replying. Use on anger, complaints, or after failing to understand the patient twice in a row.',
input_schema: {
type: 'object' as const,
properties: { reason: { type: 'string' } },
required: ['reason'],
},
},
];