1. ⚙️ Configuration
  • HMS Sovereign Introduction
  • 🚀 Get Started
    • Authentication
    • Quickstart
  • 🧩 Core Concepts
    • Assistants
    • Calls
    • Phone Numbers
    • Webhooks
  • 🏗️ Platform
    • Privacy policy
    • Dashboard Security
    • Data Processing Agreement (DPA)
    • Billing and Credits
    • EU Data Sovereignty
    • Voice Selection
    • Whitelabel Portal
  • 🛠️ SDKs
    • Node.js SDK
  • 🪝 Webhooks
    • Assistant Request
    • End of Call Report
    • Webhooks Overview
    • Webhook Security
    • Status Update
    • Tool Calls
  • ⚙️ Configuration
    • Analysis Templates
    • Custom Tools
    • SIP Trunks
    • Tool Templates
  • ✨ Features
    • AI Generation
    • Autonomous Silence Handling
    • Call Analysis
    • Call Transfers
    • Campaigns Setup
    • Outbound Campaigns
    • Voicemail Detection
    • Web Calls
    • Privacy & Compliance Features
  • 🔗 Integrations
    • MCP Server
    • BYOK Setup
    • Provider Pricing
    • xAI Grok Integration
  • 📖 Reference
    • Error Codes
    • Rate Limits
    • Troubleshooting
Book a meeting
Linkedin
Github
📄 Documentation
🔌 API Reference🤖 MCP🕐 Changelog📦 SDK🟢 Status
📄 Documentation
🔌 API Reference🤖 MCP🕐 Changelog📦 SDK🟢 Status
  1. ⚙️ Configuration

Custom Tools

Custom Tools#

Custom tools allow your AI assistant to execute functions during calls, like looking up customer information, booking appointments, or checking inventory.

How Tools Work#

1.
You define tools in your assistant's llm_config.tools[]
2.
During a call, the LLM decides when to use a tool
3.
HMS Sovereign sends a webhook request with the tool call details
4.
Your endpoint returns the result
5.
The LLM uses the result to continue the conversation

Defining a Tool#

Add tools when creating or updating your assistant:

Tool Definition Schema#

FieldTypeRequiredDescription
namestringYesUnique tool name (used by LLM)
descriptionstringYesWhat the tool does (helps LLM decide when to use it)
urlstringNoPer-tool webhook URL (overrides assistant's webhook_url)
asyncbooleanNoFire-and-forget mode (default: false)
async_responsestringNoResponse for async tools
parametersobjectNoJSON Schema for tool inputs

Writing Good Descriptions#

The description is crucial - it tells the LLM when and how to use the tool.
Good descriptions:
{
  "name": "check_inventory",
  "description": "Check product availability and stock levels. Use when customer asks if a product is in stock or available. Returns quantity available and location."
}
{
  "name": "create_support_ticket",
  "description": "Create a support ticket for issues that cannot be resolved during the call. Use only when you cannot help the customer directly. Requires a description of the issue."
}
Bad descriptions:
{
  "name": "lookup",
  "description": "Looks up data"
}

Handling Tool Calls#

When a tool is called, your webhook receives:
{
  "message": {
    "type": "tool-calls",
    "tool_call_list": [
      {
        "id": "tool_abc123",
        "type": "function",
        "function": {
          "name": "lookup_customer",
          "arguments": {
            "phone": "+31612345678"
          }
        }
      }
    ]
  }
}
Return the result:
{
  "results": [
    {
      "tool_call_id": "tool_abc123",
      "result": {
        "found": true,
        "name": "Jan de Vries",
        "email": "jan@example.com",
        "account_type": "premium",
        "member_since": "2020-03-15"
      }
    }
  ]
}

Per-Tool URLs#

Route different tools to different endpoints:
{
  "tools": [
    {
      "name": "lookup_customer",
      "description": "...",
      "url": "https://crm.example.com/api/lookup"
    },
    {
      "name": "book_appointment",
      "description": "...",
      "url": "https://calendar.example.com/api/book"
    }
  ]
}

Async Tools#

For tools that don't need to return a result (logging, notifications):
{
  "name": "log_interest",
  "description": "Log that the customer expressed interest in a product for follow-up",
  "async": true,
  "async_response": "Interest noted for follow-up.",
  "parameters": {
    "type": "object",
    "properties": {
      "product": { "type": "string" },
      "notes": { "type": "string" }
    }
  }
}
The LLM immediately receives "Interest noted for follow-up." while your webhook processes in the background.

Built-in Tools#

End Call#

Allow the assistant to end the call:
{
  "type": "end_call"
}

Transfer Call#

Allow the assistant to transfer to specific destinations:
{
  "type": "transfer_call",
  "destinations": [
    {
      "type": "number",
      "number": "+31612345678",
      "description": "Sales team - for pricing questions and quotes",
      "message": "I'm transferring you to our sales team."
    },
    {
      "type": "number",
      "number": "+31687654321",
      "description": "Technical support - for product issues",
      "message": "I'm transferring you to technical support."
    }
  ]
}

Complete Example#

Assistant configuration with multiple tools:
{
  "name": "Customer Service Assistant",
  "webhook_url": "https://api.example.com/webhooks/hms-sovereign",
  "webhook_secret": "secret123",
  "webhook_events": ["tool-calls", "end-of-call-report"],
  "llm_config": {
    "provider": "openai",
    "model": "gpt-4o-mini",
    "messages": [
      {
        "role": "system",
        "content": "You are a customer service agent. Use the available tools to help customers."
      }
    ],
    "tools": [
      {
        "name": "lookup_customer",
        "description": "Look up customer by phone number",
        "parameters": {
          "type": "object",
          "properties": {
            "phone": { "type": "string" }
          },
          "required": ["phone"]
        }
      },
      {
        "name": "check_order_status",
        "description": "Check the status of a customer order",
        "parameters": {
          "type": "object",
          "properties": {
            "order_id": { "type": "string" }
          },
          "required": ["order_id"]
        }
      },
      { "type": "end_call" },
      {
        "type": "transfer_call",
        "destinations": [
          {
            "type": "number",
            "number": "+31612345678",
            "description": "Human support for complex issues"
          }
        ]
      }
    ]
  }
}
See Tool Calls Webhook for webhook details.
Modified at 2026-03-28 09:33:16
Previous
Analysis Templates
Next
SIP Trunks
Built with