Skip to navigation

Troubleshoot tools

Overview

Troubleshoot and fix common issues with Function tool integrations in your Vapi assistants.

In this guide, you’ll learn to:

  • Diagnose why tools aren’t triggering
  • Fix response format errors
  • Resolve parameter and token issues
  • Handle multiple tool scenarios

Quick diagnosis

Start with the most common issue for your symptoms:

Tool won’t trigger

Your assistant doesn’t call the tool even when it should.

Check your assistant prompting

Use the exact tool name in your assistant instructions. If your tool is named get_weather, reference get_weather in prompts, not weather_tool.

Verify required parameters

Check that your tool schema includes all required parameters:

Tool schema
{
"name": "get_weather",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string",
"description": "City name for weather lookup"
}
},
"required": ["city"] // Must be array of required parameter names
}
}

Enable schema validation

Add strict: true to catch validation errors early:

Tool configuration
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
// ... your parameters
},
"strict": true
}
}

Check your call logs for “Schema validation errors” to identify parameter issues.

No result returned error

Logs show “ok, no result returned” or similar messages.

Use the correct response format

Your webhook must return this exact JSON structure:

{
"results": [
{
"toolCallId": "call_123",
"result": "Your response as single-line string"
}
]
}

Common format mistakes

Always return HTTP 200, even for errors. Any other status code is ignored completely.

// Return this with HTTP 200
{
"results": [
{
"toolCallId": "call_123",
"error": "Something went wrong"
}
]
}

Use single-line strings only. Line breaks cause parsing errors.

❌ Has line breaks
{
"result": "Line 1\nLine 2\nLine 3"
}
✅ Single line
{
"result": "Line 1, Line 2, Line 3"
}

The response must have the results array structure. Individual result objects won’t work.

The toolCallId in your response must exactly match the ID from the request.

Both result and error fields must be strings, not objects or arrays.

Response ignored

Tool returns data but the assistant doesn’t use it in conversation.

Fix line breaks and formatting

{
"results": [
{
"toolCallId": "call_123",
"result": "Temperature: 72°F\nCondition: Sunny\nHumidity: 45%"
}
]
}

Verify HTTP status and JSON structure

1

Check HTTP status

Ensure your webhook returns HTTP 200. Any other status code causes the response to be ignored.

3

Validate JSON format

Use a JSON validator to ensure your response structure is valid.

4

Match tool call IDs

For multiple tool calls, return a result for every call in the results array. Match each result to its call with toolCallId. Results can appear in any order.

Token truncation

Tool parameters or responses are getting cut off.

Increase the model token limit

Tool call arguments are generated by the model, so they draw on the same per-turn token budget as speech. Raise maxTokens on the assistant’s model, not on the tool. It accepts a value from 50 to 10000. When unset, the model applies its own default (currently 250).

maxTokens is a model property, not a tool property. Setting it inside tools[].function is rejected with 400 Bad Request and the message assistant.model.each value in tools.function.property maxTokens should not exist.

Look for “Token truncation warnings” in your call logs to identify when this occurs.

Multiple tools scenarios

Some tools in parallel calls fail or return wrong results.

Handle multiple tool responses

Return a result for every tool call in the results array. Match each result to its call with toolCallId. Results can appear in any order.

Multiple tool response
{
"results": [
{
"toolCallId": "call_1",
"result": "First tool success"
},
{
"toolCallId": "call_2",
"error": "Second tool failed"
},
{
"toolCallId": "call_3",
"result": "Third tool success"
}
]
}

Use HTTP 200 for the entire response, even if some individual tools error. Handle errors within the results array using the error field.

Async vs sync behavior

Tool behavior doesn’t match your expectations.

Most tools should use sync behavior unless you specifically need async processing for long-running operations.

For an async Function tool, Vapi returns an immediate Success. result to the assistant and does not use the webhook’s eventual response as the tool result. Inspect the later webhook response in Logs → Webhooks and check your server logs for the completed action. See Call logs for the Function and API Request log locations.

Reference: Required formats

Response format template

{
"results": [
{
"toolCallId": "call_123",
"result": "Single-line string response"
}
]
}

Tool schema template

Complete tool configuration
{
"type": "function",
"async": false,
"function": {
"name": "tool_name",
"description": "Clear description of what the tool does",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "Parameter description"
}
},
"required": ["param1"]
},
"strict": true
},
"server": {
"url": "https://your-server.com/webhook"
}
}

name, description, parameters and strict belong inside function. type, async and server sit on the tool itself.

Critical response rules

Always return HTTP 200 - Even for errors
Use single-line strings - No \n line breaks
Match tool call IDs exactly - From request to response
Include results array - Required structure
String types only - For result/error values

Debugging with call logs

Look for these key error messages in your call logs:

Error MessageWhat It MeansHow to Fix
”ok, no result returned”Wrong response formatUse correct JSON structure
”Tool call ID mismatches”toolCallId doesn’t matchEnsure exact ID match
”HTTP errors”Webhook not returning 200Return HTTP 200 always
”Schema validation errors”Missing required parametersCheck required array
”Token truncation warnings”Need more tokensIncrease model.maxTokens
”Response parsing errors”Malformed JSON/line breaksFix JSON format