{
  "name": "transfer_to_human",
  "description": "Put the caller through to a real person. Call this whenever any of the four escalation triggers fires: the caller asks for a person, the caller shows frustration twice, something serious comes up (illness, injury, complaint, lawyer, journalist, regulator, large party), or there is a dispute about a booking or a charge. Never resist a request for a human. Say one short sentence first, then transfer — no explanation and no defending the restaurant.",
  "speak_during_execution": true,
  "speak_after_execution": false,
  "execution_message_description": "The scripted line for this trigger, from 04-escalation.md. Never improvise it.",
  "parameters": {
    "type": "object",
    "properties": {
      "reason": {
        "type": "string",
        "enum": [
          "caller_requested_human",
          "frustration_detected",
          "complaint",
          "illness_or_injury",
          "legal_press_regulator",
          "booking_or_payment_dispute",
          "large_party_or_event",
          "other"
        ],
        "description": "Record honestly. TESTING.md §3 treats escalation correctness as the one zero-tolerance metric, and these reasons are how a missed trigger gets found in the weekly review."
      },
      "context_for_human": {
        "type": "string",
        "description": "One sentence so the person picking up isn't starting cold. The caller should not have to repeat themselves."
      }
    },
    "required": ["reason"]
  },
  "response_schema": {
    "type": "object",
    "properties": {
      "connected": { "type": "boolean" },
      "error": { "type": "string" }
    }
  },
  "_notes": {
    "target": "STAFFED_HOURS_TRANSFER_NUMBER from knowledge pack §G. Staffed hours are a SEPARATE field from opening hours and usually differ — the restaurant is open until 11pm; nobody answers the manager's mobile at 11pm.",
    "failure_path": "If connected=false, or if the call is outside staffed hours: do NOT retry and do NOT leave the caller hanging. Say the after-hours line from 04-escalation.md, then capture_lead with the matching intent and urgent=true where warranted. TEST_PLAN.md case 8 tests exactly this with the escalation phone switched off.",
    "legal_press_regulator": "Do NOT transfer for this reason — take name and number for the owner and say nothing else. The enum value exists so the weekly review can see it happened. Configure this reason to route to capture_lead, not to the transfer.",
    "never_gated": "SPEC.md D8: escalation is mandatory in every config, present on every tier, and never disabled at a client's request.",
    "qa": "Exercised by TEST_PLAN.md cases 5, 6, 7, 8, 13."
  }
}
