Response body of tool calls - properties field
# support
d
I've been using tool calls with vapi for a while and I'm trying to understand how to use the Properties field on the tool call. Specifically I'm looking for the result of including a Property but I'm not sure where to look for it in the response body. Basically I have this { "type": "function", "function": { "name": "competitorprice2", "async": false, "parameters": { "type": "object", "properties": { "userResponse": { "type": "string", "description": "Please summarize the user's response here so that it can be evaluated against the best practices for answering this objection." } } }, "description": "Fire this tool when the user addresses a \"Competitor Price Objection\" which occurs when the potential customer expresses interest in signing with a competitor due to the competitor's lower price." } } I'm expecting that by creating a userResponse property, when the function is fired, it should provide this summary of the user's response so that I can compare their response to a benchmark and evaluate if they answered correctly or not. But all I see in the response is that the tool call was fired and what it contained, I can't see the data requested by the property. Does anyone know where it is or have documentation of this? Thanks 🙂
v
@danemyers I'm glad to hear you're exploring the capabilities of VAPI! When you include a
properties
field in your tool call, it's used to define the structure and expected data for the parameters that you need to send when calling the tool. The
properties
field itself is not returned in the response; instead, it's there to guide you in constructing your request correctly. In your case, when you call the
competitorprice2
function, you should include the
userResponse
property in the parameters of your HTTP request. Here's an example of how you might structure your request:
Copy code
json
{
  "userResponse": "The customer mentioned they might go with a competitor due to better pricing."
}
When your server processes this request, it should use the value of
userResponse
to perform the necessary evaluation and then return a response that includes the results of that evaluation. The response should be in the following format:
Copy code
json
{
  "results": [
    {
      "toolCallId": "unique_identifier_for_this_call",
      "result": "The evaluation of the user's response against the benchmark."
    }
  ]
}
The
result
field in the response will contain the information you're looking for, which is the evaluation of the user's response. If you're not seeing this in the response, you'll need to ensure that your server is correctly processing the
userResponse
parameter and including the evaluation in the
result
field of the JSON response. If you need further documentation or assistance with how to structure your server's response, please ask support for more info on this.
You can continue this conversation by mentioning me in the message.
Got it. Tagging @User for additional help.
d
I don't understand this reply because I'm not calling the competitorprice2 function, the agent is calling it.
I've figured it out, you can disregard. The answer is: message.toolCalls?.[0]?.function.arguments.{nameOfPropertyHere}
3 Views