Custom Headers in tool
# support
d
I created a custom header, 'X-DBC-Message-Type,' with a constant value of '1' for a tool. When the AI invoked the tool, I didn't receive the header 'X-DBC-Message-Type.' Can you please help me with this? Call ID: 63e36180-914c-44e5-a2ba-718c350e4438
v
There is no direct support for custom headers in the tool configuration. The only way to send custom headers would be through the
server
configuration:
Copy code
/**

   * This is the server that will be hit when this tool is requested by the model.

   *

   * All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

   *

   * This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

   */

  server?: Server;
How to fix it: 1\. The tool interface only supports specific fields like
async
,
messages
,
destinations
, etc. 2\. Custom headers need to be configured at the server level, not directly in the tool configuration. To fix this, you should: Add the custom header in your server configuration:
Copy code
{
  server: {
    url: "your-url",
    headers: {
      "X-DBC-Message-Type": "1"
    }
  }
}
This is the right solution because: 1\. Server configuration is the proper place for HTTP-level customizations 2\. The tool interfaces are strictly typed to prevent unexpected configurations 3\. Headers set at the server level will be included in all requests to that endpoint