Format to return mcp server response to vapi tool ...
# support
r
Is there a specific format that we need to follow to return a response from vapi tool call to an mcp server ?
v
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:
Copy code
json
{
  "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.](https://docs.vapi.ai/tools/custom-tools#server-response-format-providing-results-and-context) Source: - [Vapi Custom Tools Documentation](https://docs.vapi.ai/tools/custom-tools#server-response-format-providing-results-and-context)
r
@User I do not see the toold id in the mcp server query
v
To return a response from your MCP server to a Vapi tool call, use this JSON format:
Copy code
json
{
  "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.](https://docs.vapi.ai/tools/custom-tools#server-response-format-providing-results-and-context) Source: - [Vapi Custom Tools Documentation](https://docs.vapi.ai/tools/custom-tools#server-response-format-providing-results-and-context)
k
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.