flat-fuchsia
flat-fuchsia4mo ago

Format to return mcp server response to vapi tool call.

Is there a specific format that we need to follow to return a response from vapi tool call to an mcp server ?
4 Replies
Vapi Support Bot
Yes, there is a specific format you must follow when returning a response from your MCP server to a Vapi tool call.
Return a JSON object like this:
{
"results": [
{
"toolCallId": "YOUR_TOOL_CALL_ID",
"result": "YOUR_RESULT"
}
]
}
{
"results": [
{
"toolCallId": "YOUR_TOOL_CALL_ID",
"result": "YOUR_RESULT"
}
]
}
Replace YOUR_TOOL_CALL_ID with the ID from the incoming request, and YOUR_RESULT with your tool's output.
See official docs for details. Source: - Vapi Custom Tools Documentation
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
flat-fuchsia
flat-fuchsiaOP4mo ago
@Duckie I do not see the toold id in the mcp server query
Vapi Support Bot
To return a response from your MCP server to a Vapi tool call, use this JSON format:
{
"results": [
{
"toolCallId": "YOUR_TOOL_CALL_ID",
"result": "YOUR_RESULT"
}
]
}
{
"results": [
{
"toolCallId": "YOUR_TOOL_CALL_ID",
"result": "YOUR_RESULT"
}
]
}
Replace YOUR_TOOL_CALL_ID with the ID from the incoming request (look for it in the tool call payload), and set YOUR_RESULT to your tool's output. This format is required for Vapi to process your tool's response correctly.
See official docs for details. Source: - Vapi Custom Tools Documentation
Sahil
Sahil4mo ago
Yes, when Vapi AI sends a tool-call to your MCP server, you must return a valid JSON response in the format {"result": "your message"} or {"result": {"message": "your message", "data": {...}}} to ensure proper integration and response handling.

Did you find this page helpful?