https://retellai.com/?utm_source=discord&utm_medium=seo logo
Bug with creating custom tools
# ❓・ai-evy-support
s
making a request to the patch endpoint for a voice agent with the request body of {"general_tools":[{"type":"custom","name":"testtool","description":"this is a test too","url":"https://api.example.com","speak_during_execution":false,"speak_after_execution":false,"method":"GET","headers":{},"query_params":{},"parameters":{},"response_variables":{},"execution_message_description":"","timeout_ms":12000}]} is returning this error: {\"error_message\":\"request/body/general_tools/0/type must be equal to one of the allowed values: end_call, request/body/general_tools/0 must have required property 'transfer_destination', request/body/general_tools/0 must have required property 'transfer_option', request/body/general_tools/0/type must be equal to one of the allowed values: transfer_call, request/body/general_tools/0 must have required property 'cal_api_key', request/body/general_tools/0 must have required property 'event_type_id',\"}..etc this same request worked just a bit ago, why is it not working? @AI Evy
a
Thanks for tagging me @slic.c. I'll look through relevant sources and get back to you shortly.
### Answer Based on the error message, the issue is with the
type
field in your custom tool configuration [(1) ]() . The correct type for custom functions should be
"custom_function"
, not
"custom"
. According to the documentation, when creating a custom function, the structure should be :
Copy code
json
{
  "type": "custom_function",
  "name": "do_my_custom_api",
  "parameters": {
    "type": "object",
    "properties": {
      "foo": { "type": "string" }
    },
    "required": ["foo"]
  }
}
Your request body should use
"type": "custom_function"
instead of
"type": "custom"
. The error is occurring because the API expects one of the allowed values:
end_call
,
transfer_call
,
check_availability_cal
,
book_appointment_cal
,
press_digit
, or
custom_function
. Update your request to:
Copy code
json
{
  "general_tools": [{
    "type": "custom_function",
    "name": "testtool",
    "description": "this is a test too",
    "url": "<https://api.example.com%22,>
    "speak_during_execution": false,
    "speak_after_execution": false,
    "method": "GET",
    "headers": {},
    "query_params": {},
    "parameters": {},
    "response_variables": {},
    "execution_message_description": "",
    "timeout_ms": 12000
  }]
}
This should resolve the validation error you're encountering .
​ To learn more, see the sources I considered: [[1] Creating Custom Tool Error](https://discord.com/channels/1186424376300679209/1278819600133390482) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
s
renanming it to custom function did not resolve the issue @AI Evy
a
Thanks for the follow-up, @slic.c. I'll get back to you soon.
### Answer Looking at the error and your configuration, there are several issues beyond just the type field that need to be addressed: 1. **Parameters structure**: For custom functions, the
parameters
field must follow a specific JSON schema format [(1) ]() . Your current
"parameters": {}
is invalid. According to the documentation, it should be structured like this :
Copy code
json
{
  "type": "object",
  "properties": {
    "city": {
      "type": "string",
      "description": "The city to get weather for"
    }
  },
  "required": ["city"]
}
2. **GET requests with parameters**: The documentation shows that parameters are only available for POST, PATCH and PUT requests [(1) ]() [(2) ]() . Since you're using a GET request, you should either: - Switch to POST method and use the parameters field - Or use query parameters instead of the parameters field for GET requests 3. **Common validation issue**: One frequent mistake mentioned in the documentation is not adding
"type": "object"
to the top level of the JSON schema [(1) ]() . Here's a corrected version for a GET request with query parameters:
Copy code
json
{
  "general_tools": [{
    "type": "custom_function",
    "name": "testtool", 
    "description": "this is a test tool",
    "url": "<https://api.example.com%22,>
    "method": "GET",
    "query_params": {
      "city": "{{city_name}}"
    },
    "parameters": {
      "type": "object",
      "properties": {},
      "required": []
    }
  }]
}
Or for a POST request with parameters:
Copy code
json
{
  "general_tools": [{
    "type": "custom_function",
    "name": "testtool",
    "description": "this is a test tool", 
    "url": "<https://api.example.com%22,>
    "method": "POST",
    "parameters": {
      "type": "object",
      "properties": {
        "city": {
          "type": "string",
          "description": "The city name"
        }
      },
      "required": ["city"]
    }
  }]
}
The validation error suggests the API is checking for required properties that match specific tool types, so ensuring the parameters field follows the correct schema format should resolve the issue [(3) ]() .
​ To learn more, see the sources I considered: [[1] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] Creating Custom Tool Error](https://discord.com/channels/1186424376300679209/1278819600133390482) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
s
once again that didnt work, i am still getting the same error as before @AI Evy
a
Thanks for the follow-up, @slic.c. I'll get back to you soon.
### Answer Based on the Discord discussion, the correct type for custom functions in
general_tools
is
"custom_function"
not
"custom"
[(1) ]() . However, since you're still getting the same error, let me provide the exact structure from the documentation. For custom functions in Single/Multi Prompt agents, the structure should be [(2) ]() :
Copy code
json
{
  "type": "object",
  "properties": {
    "city": {
      "type": "string",
      "description": "The city of the weather"
    }
  },
  "required": [
    "city"
  ]
}
The documentation emphasizes that a common mistake is not adding
"type": "object"
to the top level of the JSON schema , [(3) ]() . For your specific case, try this structure:
Copy code
json
{
  "general_tools": [{
    "type": "custom_function",
    "name": "testtool",
    "description": "this is a test tool",
    "endpoint": "<https://api.example.com%22,>
    "method": "GET",
    "headers": {},
    "parameters": {
      "type": "object",
      "properties": {},
      "required": []
    }
  }]
}
Note that I changed
"url"
to
"endpoint"
based on the Discord example [(1) ]() , and ensured the parameters field has the proper JSON schema structure with
"type": "object"
at the top level [(2) ]() , [(3) ]() . If this still doesn't work, the issue might be with the API endpoint you're calling or there could be a validation bug. You may want to contact support directly.
​ To learn more, see the sources I considered: [[1] update retell llm option 6 general_tools + documentation is bad](https://discord.com/channels/1186424376300679209/1386787226913865758) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
s
No @AI Evy The endpoint has been updated and the documenation is out of date. I need someone with technical knowledge of the product
a
Thanks for the follow-up, @slic.c. I'll get back to you soon.
### Answer I understand your frustration with the endpoint documentation being out of date [(1) ]() . Based on the Discord discussion, there appears to be a discrepancy between the API behavior and the documentation . According to the Discord thread from a Retell team member, the correct type for custom functions should be
"custom_function"
rather than
"custom"
. The example provided shows:
Copy code
json
{
  "general_tools": [
    {
      "type": "custom_function",
      "name": "get_user_info",
      "description": "Fetch user info",
      "endpoint": "<https://api.example.com/user%22,>
      "method": "POST",
      "headers": {},
      "parameters": {
        "type": "object",
        "properties": {
          "user_id": { "type": "string" }
        },
        "required": ["user_id"]
      }
    }
  ]
}
However, since you're still experiencing issues even after these corrections, and you've mentioned that the endpoint has been updated with the documentation being out of date, I'd recommend: 1. Visit [Contact Sales]() 2. Visit [) The team can provide direct technical assistance with the current API implementation that may differ from the published documentation.
​ To learn more, see the sources I considered: [[1] update retell llm option 6 general_tools + documentation is bad](https://discord.com/channels/1186424376300679209/1386787226913865758) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.