Record patient intake
record_intakeRecord a patient's symptoms, severity (1-10), and onset (ISO 8601) to persist an intake note; the system automatically assigns a triage level: routine, elevated, or urgent.
Instructions
Persist a structured intake note (symptoms, severity, onset) for a patient and assign a triage level (routine / elevated / urgent).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clinic_id | Yes | ||
| patient_id | Yes | ||
| symptoms | Yes | ||
| severity | Yes | Patient-reported severity, 1 (mild) to 10 (worst imaginable) | |
| onset_iso | Yes | When symptoms began, ISO 8601 | |
| notes | No |
Implementation Reference
- src/tools/record-intake.ts:29-54 (handler)Main handler function for the record_intake tool. Parses input args via Zod, validates the onset_iso timestamp, computes a triage level via triageFor(), calls store.insertIntakeNote(), and returns {intake}.
export function recordIntake( store: ClinicStore, raw: unknown, ): { intake: IntakeNote } { const args = Args.parse(raw); store.getPatient(args.clinic_id, args.patient_id); if (Number.isNaN(new Date(args.onset_iso).getTime())) { throw new ValidationError("onset_iso must be a valid ISO 8601 timestamp"); } const triage = triageFor(args.severity); const intake = store.insertIntakeNote({ clinic_id: args.clinic_id, patient_id: args.patient_id, symptoms: args.symptoms, severity: args.severity, onset_iso: args.onset_iso, ...(args.notes !== undefined ? { notes: args.notes } : {}), triage_level: triage, }); return { intake }; } - src/tools/record-intake.ts:6-18 (schema)Input schema definition (Zod object shape) for the record_intake tool. Defines clinic_id, patient_id, symptoms (array 1-20), severity (1-10 int), onset_iso (ISO 8601), and optional notes (max 2000 chars).
export const recordIntakeInput = { clinic_id: z.string(), patient_id: z.string(), symptoms: z.array(z.string().min(1)).min(1).max(20), severity: z .number() .int() .min(1) .max(10) .describe("Patient-reported severity, 1 (mild) to 10 (worst imaginable)"), onset_iso: z.string().describe("When symptoms began, ISO 8601"), notes: z.string().max(2000).optional(), }; - src/server.ts:72-81 (registration)Registration of record_intake tool with the MCP server. Calls server.registerTool with the tool name 'record_intake', its title/description metadata, the inputSchema (recordIntakeInput), and wraps the handler with error handling.
server.registerTool( "record_intake", { title: "Record patient intake", description: "Persist a structured intake note (symptoms, severity, onset) for a patient and assign a triage level (routine / elevated / urgent).", inputSchema: recordIntakeInput, }, wrap((args) => recordIntake(store, args)), ); - src/tools/record-intake.ts:23-27 (helper)Helper function triageFor() that maps severity (1-10) to a TriageLevel: >=8 is 'urgent', >=5 is 'elevated', else 'routine'. Used inside the recordIntake handler.
export function triageFor(severity: number): TriageLevel { if (severity >= 8) return "urgent"; if (severity >= 5) return "elevated"; return "routine"; }