Skip to main content
Glama

Patient Red Flags & Emergency Safety Checker

check_red_flags
Read-onlyIdempotent

Screens a patient consultation envelope for acute emergencies, critical drug interactions, treatment conflicts, and missing mandatory data before clinical action.

Instructions

Evaluates a patient clinical consultation envelope against multi-layered safety guardrails, detecting acute life-threatening emergencies, critical drug-drug interactions, inter-skill treatment conflicts, and missing mandatory data.

When to use:

  • Screening clinical consultation envelopes for acute medical emergencies, vital sign decompensation, red flags, or contraindicated treatment plans.

When NOT to use:

  • Computing specific numerical clinical risk scores like CHA2DS2-VA or eGFR (use calculate_clinical_score instead).

  • Screening isolated medication lists without patient context (use check_drug_interactions instead).

  • Redacting patient identifiers or personal health information (use scrub_phi instead).

  • Managing longitudinal patient records or EHR persistence (use external FHIR/EHR systems instead).

Parameter constraints & formats:

  • 'envelope': Consultation payload structured as:

    • patient_id: Anonymized audit tracking ID (e.g. 'PT-8921').

    • demographics: Evaluates age-stratified risks, biological sex, and pregnancy contraindications.

    • observations: Presenting symptoms scanned for acute emergency triggers.

    • active_medications: Current medications evaluated for critical co-prescribing DDIs.

    • vital_signs: Screened against clinical shock, sepsis, and vital decompensation thresholds.

    • proposed_plan: Proposed intervention cross-checked against clinical contraindications.

Behavioral guarantees & return states:

  • Deterministic evaluation pipeline sequentially checking acute emergencies, critical DDIs, missing data, and treatment conflicts.

  • Auth & limits: Fully local execution; requires no API keys, credentials, or network auth, with zero rate limits.

  • Verdict outcomes: gate_status returns 'PASSED_PROCEED', 'SAFE_ABSTENTION_EMERGENCY_ESCALATION' (with immediate emergency redirection and contacts), or 'SAFE_ABSTENTION_DATA_DEFICIT'. Missing vitals safely trigger data deficit status without throwing uncaught exceptions.

Input Schema

NameRequiredDescriptionDefault
envelopeYesStandardized clinical consultation envelope containing patient context, vital signs, lab observations, active medications, and proposed recommendations.

Output Schema

NameRequiredDescriptionDefault
timestampYesISO 8601 execution timestamp of the safety check.
verdict_idYesUnique cryptographic audit tracking identifier for the safety verdict.
action_planYesStructured immediate management plan with patient-safe wording and clinician summary.
gate_statusYesOverall safety outcome.
governance_bannerYesMandatory clinical governance advisory banner.
red_flags_detectedYesList of triggered acute red flags with severity and escalation targets.
inter_skill_conflictsNoCross-specialty contradictory treatment plans (e.g. anticoagulation in active bleeding).
provenance_violationsNoData provenance boundary violations or unverified claims.
critical_ddis_detectedYesList of severe or fatal drug-drug interactions detected across active medications.
missing_mandatory_dataYesMandatory demographic or clinical data fields absent from the patient envelope.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed19 schema fields changedv0.1.2
    • addedInput schema / properties / envelope / properties / active_medications / examples
      Added value: +[
      +  [
      +    "aspirin",
      +    "warfarin",
      +    "concor"
      +  ]
      +]
    • addedInput schema / properties / envelope / properties / active_medications / items / minLength
      Added value: +1
    • addedInput schema / properties / envelope / properties / demographics / properties / age_years / examples
      Added value: +[
      +  45
      +]
    • addedInput schema / properties / envelope / properties / demographics / properties / age_years / maximum
      Added value: +120
    • addedInput schema / properties / envelope / properties / demographics / properties / age_years / minimum
      Added value: +0
    • addedInput schema / properties / envelope / properties / demographics / properties / biological_sex / examples
      Added value: +[
      +  "male"
      +]
    • addedInput schema / properties / envelope / properties / demographics / properties / pregnancy_status / default
      Added value: +"not_pregnant"
    • addedInput schema / properties / envelope / properties / demographics / properties / pregnancy_status / enum
      Added value: +[
      +  "not_pregnant",
      +  "PREGNANT",
      +  "CONFIRMED_PREGNANT",
      +  "first_trimester",
      +  "second_trimester",
      +  "third_trimester"
      +]
    • addedInput schema / properties / envelope / properties / demographics / properties / pregnancy_status / examples
      Added value: +[
      +  "not_pregnant"
      +]
    • addedInput schema / properties / envelope / properties / observations / examples
      Added value: +[
      +  [
      +    "crushing chest pain",
      +    "shortness of breath",
      +    "diaphoresis"
      +  ]
      +]
    • addedInput schema / properties / envelope / properties / observations / items / minLength
      Added value: +1
    • addedInput schema / properties / envelope / properties / patient_id / examples
      Added value: +[
      +  "PT-8921"
      +]
    • addedInput schema / properties / envelope / properties / patient_id / minLength
      Added value: +1
    • addedInput schema / properties / envelope / properties / proposed_plan / examples
      Added value: +[
      +  "Discharge on oral NSAIDs and follow up in clinic"
      +]
    • addedInput schema / properties / envelope / properties / vital_signs / properties
      Added value: +{
      +  "oxygen_saturation": {
      +    "description": "SpO2 percentage.",
      +    "examples": [
      +      98
      +    ],
      +    "maximum": 100,
      +    "minimum": 50,
      +    "type": "integer"
      +  },
      +  "pulse_rate": {
      +    "description": "Heart rate in beats per minute.",
      +    "examples": [
      +      78
      +    ],
      +    "maximum": 300,
      +    "minimum": 20,
      +    "type": "integer"
      +  },
      +  "respiratory_rate": {
      +    "description": "Breaths per minute.",
      +    "examples": [
      +      16
      +    ],
      +    "maximum": 100,
      +    "minimum": 0,
      +    "type": "integer"
      +  },
      +  "systolic_bp": {
      +    "description": "Systolic blood pressure in mmHg.",
      +    "examples": [
      +      120
      +    ],
      +    "maximum": 300,
      +    "minimum": 40,
      +    "type": "integer"
      +  },
      +  "temperature_celsius": {
      +    "description": "Body temperature in degrees Celsius.",
      +    "examples": [
      +      37
      +    ],
      +    "maximum": 45,
      +    "minimum": 25,
      +    "type": "number"
      +  }
      +}
    • addedOutput schema / properties / action_plan / required
      Added value: +[
      +  "user_safe_message",
      +  "clinician_summary",
      +  "emergency_redirection_required",
      +  "emergency_contacts"
      +]
    • changedOutput schema / properties / gate_status / description
      Previous value: -"Overall safety outcome: 'PASSED_PROCEED', 'SAFE_ABSTENTION_EMERGENCY_ESCALATION', or 'SAFE_ABSTENTION_DATA_DEFICIT'."New value: +"Overall safety outcome."
    • addedOutput schema / properties / gate_status / enum
      Added value: +[
      +  "PASSED_PROCEED",
      +  "SAFE_ABSTENTION_EMERGENCY_ESCALATION",
      +  "SAFE_ABSTENTION_DATA_DEFICIT"
      +]
    • addedOutput schema / required
      Added value: +[
      +  "verdict_id",
      +  "timestamp",
      +  "gate_status",
      +  "red_flags_detected",
      +  "critical_ddis_detected",
      +  "missing_mandatory_data",
      +  "governance_banner",
      +  "action_plan"
      +]
  2. Changed4 schema fields changedv0.1.1
    • addedInput schema / properties / envelope / description
      Added value: +"Standardized clinical consultation envelope containing patient context, vital signs, lab observations, active medications, and proposed recommendations."
    • addedInput schema / properties / envelope / properties
      Added value: +{
      +  "active_medications": {
      +    "description": "List of current active prescription and over-the-counter medications.",
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  },
      +  "demographics": {
      +    "description": "Patient demographic parameters including age, biological sex, and pregnancy status.",
      +    "properties": {
      +      "age_years": {
      +        "description": "Patient age in years.",
      +        "type": "number"
      +      },
      +      "biological_sex": {
      +        "description": "Biological sex.",
      +        "enum": [
      +          "male",
      +          "female"
      +        ],
      +        "type": "string"
      +      },
      +      "pregnancy_status": {
      +        "description": "Pregnancy trimester or confirmation status.",
      +        "type": "string"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "observations": {
      +    "description": "List of reported clinical symptoms, physical examination findings, or complaints.",
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  },
      +  "patient_id": {
      +    "description": "Unique anonymized patient identifier.",
      +    "type": "string"
      +  },
      +  "proposed_plan": {
      +    "description": "Proposed therapeutic plan or clinical recommendation to be safety-screened.",
      +    "type": "string"
      +  },
      +  "vital_signs": {
      +    "description": "Current physiological vital signs (heart rate, blood pressure, SpO2, respiratory rate, temperature).",
      +    "type": "object"
      +  }
      +}
    • addedInput schema / properties / envelope / required
      Added value: +[
      +  "patient_id"
      +]
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "description": "Comprehensive clinical safety verdict containing gate status, detected emergency red flags, drug interactions, missing data alerts, and immediate action plans.",
      +  "properties": {
      +    "action_plan": {
      +      "description": "Structured immediate management plan with patient-safe wording and clinician summary.",
      +      "properties": {
      +        "clinician_summary": {
      +          "description": "Technical clinical summary for attending healthcare providers.",
      +          "type": "string"
      +        },
      +        "emergency_contacts": {
      +          "description": "Jurisdiction-specific emergency medical phone numbers.",
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        },
      +        "emergency_redirection_required": {
      +          "description": "True if patient requires immediate emergency department transfer.",
      +          "type": "boolean"
      +        },
      +        "user_safe_message": {
      +          "description": "Patient-facing guidance message in plain, safe language.",
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "critical_ddis_detected": {
      +      "description": "List of severe or fatal drug-drug interactions detected across active medications.",
      +      "items": {
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "gate_status": {
      +      "description": "Overall safety outcome: 'PASSED_PROCEED', 'SAFE_ABSTENTION_EMERGENCY_ESCALATION', or 'SAFE_ABSTENTION_DATA_DEFICIT'.",
      +      "type": "string"
      +    },
      +    "governance_banner": {
      +      "description": "Mandatory clinical governance advisory banner.",
      +      "type": "string"
      +    },
      +    "inter_skill_conflicts": {
      +      "description": "Cross-specialty contradictory treatment plans (e.g. anticoagulation in active bleeding).",
      +      "items": {
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "missing_mandatory_data": {
      +      "description": "Mandatory demographic or clinical data fields absent from the patient envelope.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "provenance_violations": {
      +      "description": "Data provenance boundary violations or unverified claims.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "red_flags_detected": {
      +      "description": "List of triggered acute red flags with severity and escalation targets.",
      +      "items": {
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "timestamp": {
      +      "description": "ISO 8601 execution timestamp of the safety check.",
      +      "type": "string"
      +    },
      +    "verdict_id": {
      +      "description": "Unique cryptographic audit tracking identifier for the safety verdict.",
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  3. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the readOnly/idempotent/non-destructive annotations by disclosing the deterministic sequential evaluation order, that execution is fully local with no auth or rate limits, and the three possible gate_status verdicts including emergency escalation behavior. It also states failure semantics — missing vitals yield SAFE_ABSTENTION_DATA_DEFICIT rather than an exception — which is exactly the kind of behavioral contract an agent needs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded purpose sentence followed by clearly labeled sections and bullets, so an agent can skim to the routing decision. Slightly bloated: the envelope field list partially restates the schema, and the verdict/return-state block overlaps the output schema, costing a small amount of redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single nested-object parameter with an output schema, this covers everything an agent needs: what is checked, in what order, what the verdict values mean, what happens on incomplete data, and which sibling handles adjacent tasks. Nothing material is left unresolved.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3; the description earns an extra point by explaining what each envelope sub-object is screened against (age-stratified risks, pregnancy contraindications, shock/sepsis thresholds, plan cross-checked against contraindications), which the schema only labels. It stops short of stating which conditions or value thresholds actually trigger a flag, leaving the clinical logic opaque.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence names a specific verb (evaluates) and a specific resource (clinical consultation envelope) and enumerates the four detection layers: emergencies, DDIs, treatment conflicts, missing data. The 'When NOT to use' section explicitly contrasts it with calculate_clinical_score, check_drug_interactions, and scrub_phi, so an agent can route correctly without opening sibling schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit when-to-use (screening full consultation envelopes for acute emergencies, vital decompensation, contraindications) and four when-not-to-use cases, each paired with the correct alternative tool. The separation from check_drug_interactions (isolated med lists vs. patient context) is the exact distinction an agent would otherwise have to guess.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.