[
  {
    "type": "function",
    "function": {
      "name": "transfer_call",
      "description": "Transfer the current call to another department or agent. Use this when the caller explicitly asks to be connected to another person or department.",
      "parameters": {
        "type": "object",
        "properties": {
          "department": {
            "type": "string",
            "description": "The department or agent to transfer to",
            "enum": [
              "M-Force expert",
              "M-Flux expert",
              "M-Trade expert",
              "M-Smart expert",
              "WhatsApp Agent",
              "Complaint Department",
              "Ticket Agent"
            ]
          },
          "reason": {
            "type": "string",
            "description": "Brief reason for the transfer"
          }
        },
        "required": [
          "department",
          "reason"
        ]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "search_extension",
      "description": "Search the company directory by person name or department. Use this to look up a person's extension and availability before transferring. Returns matching entries with extension number, status, and availability. You MUST call this before using dial_extension.",
      "parameters": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Person's name (partial or full) to search for"
          },
          "department": {
            "type": "string",
            "description": "Department name to search for"
          }
        }
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "dial_extension",
      "description": "Transfer the call to a specific person. Use ONLY after search_extension confirms status is ONLINE and current time is within their working hours. Do NOT use when BUSY, NOT REGISTERED, OUTSIDE HOURS, or OFFLINE.",
      "parameters": {
        "type": "object",
        "properties": {
          "extension": {
            "type": "string",
            "description": "The 4-digit extension number from search_extension results"
          },
          "name": {
            "type": "string",
            "description": "The person's full name"
          }
        },
        "required": [
          "extension",
          "name"
        ]
      }
    },
    "x_schedule": {
      "days": [
        "mon",
        "tue",
        "wed",
        "thu",
        "fri"
      ],
      "start": "09:00",
      "end": "18:00",
      "timezone": "Asia/Kuala_Lumpur"
    }
  },
  {
    "type": "function",
    "function": {
      "name": "dial_department",
      "description": "Ring all available members of a department simultaneously. Use when the caller asks for a department or team without naming a specific person.",
      "parameters": {
        "type": "object",
        "properties": {
          "department": {
            "type": "string",
            "description": "Department name from search_extension results"
          }
        },
        "required": [
          "department"
        ]
      }
    },
    "x_schedule": {
      "days": [
        "mon",
        "tue",
        "wed",
        "thu",
        "fri"
      ],
      "start": "09:00",
      "end": "18:00",
      "timezone": "Asia/Kuala_Lumpur"
    }
  },
  {
    "type": "function",
    "function": {
      "name": "end_call",
      "description": "Hang up the call. Say a brief goodbye before calling this function. Use when the conversation is done, after confirming message delivery, appointment booking, or when office is closed/holiday.",
      "parameters": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "description": "Brief reason for ending the call"
          }
        },
        "required": [
          "reason"
        ]
      }
    }
  },
  {
    "type": "function",
    "function": {
      "name": "leave_message",
      "description": "Leave a message for a specific person who is unavailable. Before calling: collect the caller's name, then their message (one at a time). Use CALLER PHONE from REFERENCE DATA for phone unless the caller provides a different number. When calling this function, include spoken text confirming delivery.",
      "parameters": {
        "type": "object",
        "properties": {
          "target_extension": {
            "type": "string",
            "description": "The 4-digit extension of the unavailable person"
          },
          "customer_name": {
            "type": "string",
            "description": "The caller's name exactly as they stated it"
          },
          "customer_phone": {
            "type": "string",
            "description": "Caller's phone number - use CALLER PHONE from REFERENCE DATA if not explicitly provided"
          },
          "message": {
            "type": "string",
            "description": "The message content from the caller"
          }
        },
        "required": [
          "target_extension",
          "customer_name",
          "customer_phone",
          "message"
        ]
      }
    },
    "x_schedule": {
      "days": [
        "mon",
        "tue",
        "wed",
        "thu",
        "fri"
      ],
      "start": "09:00",
      "end": "18:00",
      "timezone": "Asia/Kuala_Lumpur"
    }
  },
  {
    "type": "function",
    "function": {
      "name": "leave_department_message",
      "description": "Leave a message for all members of a department. Before calling: collect the caller's name, then their message (one at a time). When calling this function, include spoken text confirming delivery.",
      "parameters": {
        "type": "object",
        "properties": {
          "department": {
            "type": "string",
            "description": "Department name from search_extension results"
          },
          "customer_name": {
            "type": "string",
            "description": "The caller's name exactly as they stated it"
          },
          "customer_phone": {
            "type": "string",
            "description": "Caller's phone number - use CALLER PHONE from REFERENCE DATA if not explicitly provided"
          },
          "message": {
            "type": "string",
            "description": "The message content from the caller"
          }
        },
        "required": [
          "department",
          "customer_name",
          "customer_phone",
          "message"
        ]
      }
    },
    "x_schedule": {
      "days": [
        "mon",
        "tue",
        "wed",
        "thu",
        "fri"
      ],
      "start": "09:00",
      "end": "18:00",
      "timezone": "Asia/Kuala_Lumpur"
    }
  },
  {
    "type": "function",
    "function": {
      "name": "book_appointment",
      "description": "Book an appointment with a person. Before calling: collect these one at a time - who they want to meet, caller's name, preferred date and time, phone number, reason. Look up the target person's extension using search_extension silently. When calling this function, include spoken text confirming the booking.",
      "parameters": {
        "type": "object",
        "properties": {
          "extension": {
            "type": "string",
            "description": "Extension of the person the appointment is with, from search_extension results"
          },
          "caller_name": {
            "type": "string",
            "description": "The caller's name"
          },
          "preferred_date": {
            "type": "string",
            "description": "Preferred date and time for the appointment"
          },
          "phone_number": {
            "type": "string",
            "description": "Caller's phone number - use CALLER PHONE from REFERENCE DATA if not provided"
          },
          "purpose": {
            "type": "string",
            "description": "Reason for the appointment"
          }
        },
        "required": [
          "extension",
          "caller_name",
          "preferred_date",
          "phone_number",
          "purpose"
        ]
      }
    }
  }
]