{
  "name": "create_booking",
  "description": "Put a confirmed reservation into the restaurant's real calendar. Only call this after check_availability confirmed the slot is free AND you have read the details back to the caller. If it fails, do NOT end the call silently — say you're having trouble putting it in, take their details with capture_lead, and tell them someone will confirm by message.",
  "speak_during_execution": true,
  "speak_after_execution": false,
  "execution_message_description": "A short natural line while this runs, e.g. 'Putting that in for you now.'",
  "parameters": {
    "type": "object",
    "properties": {
      "date": { "type": "string", "description": "YYYY-MM-DD, restaurant local timezone" },
      "time": { "type": "string", "description": "HH:MM 24-hour" },
      "party_size": { "type": "integer", "minimum": 1 },
      "caller_name": {
        "type": "string",
        "description": "As the caller said it. Do not correct the spelling of a name you are unsure of."
      },
      "caller_phone": {
        "type": "string",
        "description": "The booking key — used later to find, change or cancel this booking. Read it back digit by digit before calling this tool. If you could not capture it clearly after two attempts, use capture_lead instead."
      },
      "seating_preference": {
        "type": "string",
        "enum": ["indoor", "outdoor", "private_room", "no_preference"],
        "default": "no_preference"
      },
      "notes": {
        "type": "string",
        "description": "Special requests in the caller's own words: birthday, anniversary, high chair, wheelchair access, allergy. An allergy MUST be recorded here. Recording an allergy is not the same as clearing a dish — never tell a caller a dish is safe."
      },
      "channel": {
        "type": "string",
        "enum": ["phone", "whatsapp"],
        "description": "How the caller reached us. Determines whether confirmation goes by SMS or WhatsApp."
      }
    },
    "required": ["date", "time", "party_size", "caller_name", "caller_phone"]
  },
  "response_schema": {
    "type": "object",
    "properties": {
      "booking_id": { "type": "string" },
      "confirmation_sent": {
        "type": "boolean",
        "description": "If false, still tell the caller the booking is made — but do not claim a confirmation was sent."
      },
      "error": {
        "type": "string",
        "description": "Present only on failure. Fall back to capture_lead and say someone will confirm by message. Never say the booking is made when this is set."
      }
    }
  },
  "_notes": {
    "event_body": "API_CONTRACT.md §2: every booking carries caller name + phone + service in the event body.",
    "confirmation": "SMS in US, WhatsApp in BD/Gulf. Sent by the platform-native tool or the n8n flow, not by a separate assistant tool call.",
    "duration": "Slot length and inter-sitting buffer come from knowledge pack §D and are set in calendar config, not passed here.",
    "qa": "Exercised by TEST_PLAN.md cases 1, 2, 15, 18 (no phantom booking on hangup), 20."
  }
}
