Custom Tool Response
# support
e
Is anyone else experiencing unexpected behavior with tool calls? I implemented a custom tool that triggers my Make.com webhook, which then returns all available slots. The response from my scenario seems to match what Vapi is expecting. However, the voice agent keeps saying there are no appointments available. I checked the logs and noticed some other inconsistencies: • The assistant said it would check for 9 AM, but instead checked for 2:30 PM. • It said it would check for next week, but actually checked for today. This morning, the Make.com scenario was working perfectly fine, but I started having issues this afternoon. I also checked the Vapi Logs, and they indicate that the agent didn’t receive a response… From Make.com:
Copy code
[
    {
        "body": "{\n  \"results\": [\n    {\n      \"toolCallId\": \"call_g4LBH87kQ7fmcKFbcVaKKlLV\",\n      \"result\": \"These are all available slots: {\"2025-02-21\":[{\"start\":\"2025-02-21T08:30:00.000Z, 2025-02-21T08:45:00.000Z, 2025-02-21T09:00:00.000Z, 2025-02-21T09:15:00.000Z, 2025-02-21T09:45:00.000Z, 2025-02-21T10:30:00.000Z, 2025-02-21T10:45:00.000Z, 2025-02-21T11:30:00.000Z, 2025-02-21T11:45:00.000Z, 2025-02-21T12:30:00.000Z, 2025-02-21T12:45:00.000Z, 2025-02-21T13:15:00.000Z, 2025-02-21T13:45:00.000Z, 2025-02-21T14:30:00.000Z, 2025-02-21T14:45:00.000Z, 2025-02-21T15:30:00.000Z, 2025-02-21T15:45:00.000Z\"}]}\"\n    }\n  ]\n}",
        "status": 200,
        "headers": []
    }
]
From the Vapi logs:
Copy code
{
  "role": "tool_call_result",
  "time": 1740067005339,
  "secondsFromStart": 10.043,
  "name": "getAvailability",
  "result": "No result returned.",
  "toolCallId": "call_g4LBH87kQ7fmcKFbcVaKKlLV"
}
v
Hey! To help track down this issue, could you share: - The call ID This would really help us figure out what went wrong!
e
The call ID was 647d27c9-4da1-4419-91b7-0db2012310ec
v
The response should have a valid JSON string for the result field. `FYI`:Tool calls are expected to return result of type string w/o any line breaks, your returning result with line breaks. Your current stringified object structure is malformed, and has line breaks.
current
Copy code
{
  "results": [
    {
      "toolCallId": "call_g4LBH87kQ7fmcKFbcVaKKlLV",
      "result": "These are all available slots: {"2025-02-21":[{"start":"2025-02-21T08:30:00.000Z, 2025-02-21T08:45:00.000Z, 2025-02-21T09:00:00.000Z, 2025-02-21T09:15:00.000Z, 2025-02-21T09:45:00.000Z, 2025-02-21T10:30:00.000Z, 2025-02-21T10:45:00.000Z, 2025-02-21T11:30:00.000Z, 2025-02-21T11:45:00.000Z, 2025-02-21T12:30:00.000Z, 2025-02-21T12:45:00.000Z, 2025-02-21T13:15:00.000Z, 2025-02-21T13:45:00.000Z, 2025-02-21T14:30:00.000Z, 2025-02-21T14:45:00.000Z, 2025-02-21T15:30:00.000Z, 2025-02-21T15:45:00.000Z"}]}"
    }
  ]
}
expected
Copy code
{
  "results": [
    {
      "toolCallId": "call_g4LBH87kQ7fmcKFbcVaKKlLV",
      "result": "These are all available slots: {"2025-02-21":[{"start":"2025-02-21T08:30:00.000Z"},{"start":"2025-02-21T08:45:00.000Z"},{"start":"2025-02-21T09:00:00.000Z"},{"start":"2025-02-21T09:15:00.000Z"},{"start":"2025-02-21T09:45:00.000Z"},{"start":"2025-02-21T10:30:00.000Z"},{"start":"2025-02-21T10:45:00.000Z"},{"start":"2025-02-21T11:30:00.000Z"},{"start":"2025-02-21T11:45:00.000Z"},{"start":"2025-02-21T12:30:00.000Z"},{"start":"2025-02-21T12:45:00.000Z"},{"start":"2025-02-21T13:15:00.000Z"},{"start":"2025-02-21T13:45:00.000Z"},{"start":"2025-02-21T14:30:00.000Z"},{"start":"2025-02-21T14:45:00.000Z"},{"start":"2025-02-21T15:30:00.000Z"},{"start":"2025-02-21T15:45:00.000Z"}]}"
    }
  ]
}
e
Hi Shubham, I changed it to the expected format but still no success...
Copy code
"body": "{\n  \"results\": [\n    {\n      \"toolCallId\": \"call_3Vr0SnDCfOKyYjnCgJ4Qv6YI\",\n      \"result\": \"These are all available slots: {\"2025-02-28\":[{\"start\":\"2025-02-28T08:30:00.000Z\"},{\"start\":\"2025-02-28T08:45:00.000Z\"},{\"start\":\"2025-02-28T09:30:00.000Z\"},{\"start\":\"2025-02-28T09:45:00.000Z\"},{\"start\":\"2025-02-28T10:30:00.000Z\"},{\"start\":\"2025-02-28T10:45:00.000Z\"},{\"start\":\"2025-02-28T12:30:00.000Z\"},{\"start\":\"2025-02-28T12:45:00.000Z\"},{\"start\":\"2025-02-28T13:00:00.000Z\"},{\"start\":\"2025-02-28T13:15:00.000Z\"},{\"start\":\"2025-02-28T13:45:00.000Z\"},{\"start\":\"2025-02-28T14:30:00.000Z\"},{\"start\":\"2025-02-28T14:45:00.000Z\"},{\"start\":\"2025-02-28T15:30:00.000Z\"},{\"start\":\"2025-02-28T15:45:00.000Z\"}]}\"\n    }\n  ]\n}",
        "status": 200,
        "headers": []
    }
call id: c412712d-886a-4544-b5cd-29c4562e12ec
This has been solved. The quotation marks caused an issue with the agent.
2 Views