Inspiration

Hospital Emergency Departments operate under extreme operational stress. Nurse shortages and unpredictable patient surges force Charge Nurses to make high-stakes staffing and triage re-allocation decisions under severe cognitive load. While agentic AI has immense potential to ingest census telemetry, compute queuing delays, and formulate mitigation options, autonomous AI execution in clinical environments is unsafe.

We built SafeStaff Shift Commander to demonstrate how the imperative WebMCP API (document.modelContext.registerTool) allows client-side AI agents to serve as powerful decision-support partners—inspecting, forecasting, and comparing scenarios—while enforcing strict Human-In-The-Loop (HITL) governance: AI agents are architecturally prohibited from self-approving staffing changes.

What it does

SafeStaff Shift Commander is a synthetic hospital operations command-center dashboard:

  • Live Shift Snapshot Telemetry: Displays waiting room volume (42 patients), high-acuity arrivals (3 ESI 1-2 critical resuscitation cases), active floor nurses (7 RNs), and door-to-provider forecast wait time (96 min vs 60 min safe operational target).
  • Scenario Stress-Testing ("Model Nurse Call-Out"): With a single toggle, simulates an unplanned nurse absence in Pod B. Available nurses drop to 6, and projected wait surges to 118 minutes (+58 min over the safe target).
  • Selectable Evidence-Informed Staffing Plans: Generates and compares 3 actionable mitigation strategies:
    1. Protect High-Acuity Flow: Ring-fences dedicated 1:1 and 1:2 coverage for critical pods, buffering non-urgent queue.
    2. Call-In Contingency: Dispatches an on-call Float Pool RN, bringing wait time down to 68 minutes.
    3. Hold and Monitor: Preserves float hours with a 30-minute re-evaluation surge threshold.
  • Human-In-The-Loop Signoff & Governance: Charge Nurses must physically click Approve Plan or Override Recommendation (with a mandatory clinical rationale prompt).
  • Compliance Audit Trail: Immutable chronological log capturing every AI tool invocation, parameter payload, human approval, and clinical override with exportable JSON.
  • Interactive WebMCP Live Console: Embedded workbench for judges and developers to inspect JSON schemas, customize input parameters, and execute tools directly in the browser.

How we built it

  • Frontend Architecture: Built with React 18, Vite 6, and Lucide React. We styled the interface using an operations command-center theme (slate navy #060a14, glowing cyan #06b6d4, and amber risk indicators #f59e0b).
  • Imperative WebMCP Tools: Registered 5 tools directly into document.modelContext.registerTool(...):
    • get_shift_snapshot: Retrieves synthetic department census, triage acuity levels, nurse count, and safe targets.
    • forecast_wait_time: Forecasts waiting room delays based on patient volume, acuity distribution, and nurse headcount.
    • generate_staffing_options: Proposes candidate staffing allocations with pros/cons and risk scores.
    • compare_staffing_scenario: Compares baseline, call-out, and contingency strategies side-by-side.
    • submit_human_approval: HITL Safety Guardrail — Strictly returns {"status": "human_confirmation_required"} to prove agents cannot self-approve staffing changes.
  • Simulation Engine: Realistic, deterministic queue modeling and ESI 1–5 triage breakdown without any real patient data or PHI.

Challenges we ran into

  • Enforcing the HITL Safety Boundary: Designing an agentic workflow where the AI can simulate, forecast, and prepare recommendations while guaranteeing that autonomous approval attempts are intercepted with {"status": "human_confirmation_required"}.
  • Telemetry Visual Hierarchy: Balancing high-density hospital command center metrics (acuity bars, wait variance chips, pod allocations, financial impact) within an intuitive, responsive dark-mode interface.

Accomplishments that we're proud of

  • Pure Client-Side WebMCP Execution: The entire WebMCP tool suite operates directly in the browser via document.modelContext without requiring external backend servers.
  • Dual-Role Demonstration: Clear visual and architectural separation between what the AI Agent sees/does (WebMCP tools) and what the licensed Clinician sees/does (Command Center UI + Audit Signoff).
  • Interactive WebMCP Inspector: An embedded developer playground allowing instant live testing of all tool inputs and outputs.

What we learned

WebMCP provides an elegant, structured way to expose rich application state and actions to client-side AI agents without complex scraping or brittle DOM querying. The imperative registerTool pattern is clean, expressive, and easily governed with safety guardrails.

What's next for SafeStaff Shift Commander — WebMCP

  • Synthetic FHIR/HL7 Feeds: Connecting synthetic hospital EHR streams for multi-unit hospital flow (ICU, Med-Surg, Stepdown).
  • Predictive 12-Hour Surge Heatmaps: Expanding queue forecasting to incorporate EMS ambulance dispatch data and regional surge modeling.

Built With

Share this project:

Updates