Assistant not Parsing tool call results
# support
k
I am sending [ { "results": [ { "toolCallId": "call_hJL6kSF0pOGjNtdQ", "result": "The requested appointment time at 12:00 p.m. EST on April 21, 2025, is available for booking. Let me know if you wish to proceed with creating an event." } ] } ] in a webhook response node in n8n and I don't think my assistant is parsing the response. Not sure I have the assistant configured properly. Anybody to help with this? I have turned my n8n logic upside down and inside out. It always returns the correct availability. It works excellent. The webhook logs show a 200 code and the response is the correct response. My assistant isn't parsing the result. I have function and tool calls and responses checked in client messages. What am I missing?
v
Hi there! 👋 I see you're having trouble with your assistant not parsing tool call results from your n8n webhook response. I noticed that your JSON response format has an extra array wrapper that's likely causing the parsing issue. However, I can help with the parts of your question related to the correct format and configuration. Looking at the JSON you shared, I can see the issue right away. The correct format for tool call responses should be:
Copy code
json
{
  "results": [
    {
      "toolCallId": "call_hJL6kSF0pOGjNtdQ",
      "result": "The requested appointment time at 12:00 p.m. EST on April 21, 2025, is available for booking. Let me know if you wish to proceed with creating an event."
    }
  ]
}
Notice that your response has an extra array wrapper
[ ]
around the entire object. According to the [documentation on tool calling](https://docs.vapi.ai/tools-calling), the response must be a JSON object (not an array) with a "results" array inside it. Here are some other things to check: 1. **Content-Type Header**: Make sure your n8n webhook response node has the
Content-Type
header set to
application/json
. 2. **Client Messages Configuration**: Verify that your assistant has both "tool-calls" and "tool-calls-result" checked in the clientMessages configuration. 3. **Serialization**: Ensure that the data is correctly serialized into a JSON string before being sent. The n8n webhook response node might be automatically adding the array wrapper. 4. **JSON Validation**: Use a tool like [jsonlint.com](https://jsonlint.com/) to validate your JSON response format. 5. **Manual Testing**: Try testing your webhook endpoint directly with a tool like Postman or cURL to see if the issue persists outside of n8n. If you've confirmed the format is correct and you're still having issues, it might be worth checking your server logs for any debugging artifacts that could provide more insight into what's happening.
Is there anything else you'd like me to help with regarding your webhook configuration or assistant setup? Sources: - [Troubleshooting n8n webhook response node issues](https://discord.com/channels/1211482211119796234/1330221332452999321) - [How does an assistant handle JSON responses from tool calls?](https://docs.vapi.ai/tools-calling) - [n8n webhook response node configuration options](https://discord.com/channels/1211482211119796234/1339900285727805513) - [How to configure an assistant to parse webhook responses](https://discord.com/channels/1211482211119796234/1341460297382236262)
k
Copy code
{
  "results": [
    {
      "tool_call_id": "call_R1GU55uw4SYNKlNx",
      "result": "There is an existing appointment for \"Bike Riding\" scheduled from 10:00 AM to 11:00 AM on April 25, 2025. This time slot is not available for a new appointment. If you have a different time in mind or need assistance with other dates, please let me know!"
    }
  ]
}
h
@Vapi Support Bot
k
Looking into it
k
I've tested it with the chat interface on the dashboard and it works flawlessly. But on a call or through the speak with assistant on the dashboard, it hallucinates.
None of that worked. This is the response in the webhook log: [12:33 PM] { "results": [ { "tool_call_id": "call_R1GU55uw4SYNKlNx", "result": "There is an existing appointment for "Bike Riding" scheduled from 10:00 AM to 11:00 AM on April 25, 2025. This time slot is not available for a new appointment. If you have a different time in mind or need assistance with other dates, please let me know!" } ] }
k
Double-check if your assistant’s tool parsing is configured correctly in the workflow, and ensure the JSON response from the webhook is formatted precisely as expected by the assistant. You could try flattening the JSON response into a string to see if that helps, as sometimes parsing issues occur with JSON arrays. If needed, checking assistant settings or webhook setup might also provide more clues. Be sure its parsing in valid JSON.
k
It's parsing the json because the chat in the dashboard repeats the result verbatim
k
Even though it's parsing the JSON correctly, voice interactions can sometimes cause the assistant to add unnecessary details. I recommend updating your system prompt to clearly instruct the assistant to read tool results exactly as provided, without adding anything. You could also try formatting the tool response as a simple conversational string to make it easier for voice delivery. Let me know if that helps!
k
Ok, thanks. I already have the json flattened. I'll play around witht he prompt and see if I can trick it into working. 🙂
This is solved. I guess I'm embarassed by this, but I had no idea the voice models made a difference. I only thought the chat model mattered.
k
Glad I could help :)