Struggling to return an ID from a tool call in my ...
# support
j
Hi Folks, I hope someone can give me some advice. I'm creating a property viewing assistant. I have the assistant calling a tool which fetches JSON data from a real estate CRM. In the JSON data we return information about the properties and an ID for each property. The tool is working well, and the assistant can help the caller find the property they want to view. My issue is that I'm trying to extract the propertyId of the property the caller wants to book a viewing of. I just can't seem to get the data extraction prompt right, here's my description for the structured data:- "This is the propertyId of the property the customer wants a viewing of. The propertyId is in the JSON object of the property. Do not return the property address, but the value in the "propertyId" element of the JSON. " Here's an example of the JSON returned from my tool call:- "metadata": { "responseBody": [ { "price": "£300,000", "address": "Trinity Way, Minehead, Somerset", "summary": "MOTIVATED SELLERS! UPWARD CHAIN IN PLACE! Delightful accessible ground floor apartment boasting three bedrooms (principal en suite), spacious living accommodation together with a balcony with sea views and allocated parking. Must be viewed to appreciate! Garage available by separate negotiation.", "bedrooms": 3, "propertyId": 517021 }, { "price": "£285,000", "address": "St. Louis Cottage, Minehead, Somerset", "summary": "A beautiful chocolate box cottage peacefully tucked away just moments from Minehead High Street. Packed with character and charm, with lovely gardens, a fireplace, original range, and rare off-road parking. Once part of the Luttrell Estate of Dunster Castle.", "bedrooms": 2, "propertyId": 802567 } etc.... How do I get the assistant to pass over the "propertyId", so far I've only been able to do it when asking the assistant for the propertyId when chatting with it.
v
To extract just the
propertyId
in your structured data, update your assistant's
analysisPlan
with a focused prompt and schema like this:
Copy code
json
{
  "structuredDataPrompt": "Extract only the propertyId of the property the customer wants to view from the tool call JSON. Do not include the address or other fields.",
  "structuredDataSchema": {
    "type": "object",
    "properties": {
      "propertyId": { "type": "number" }
    },
    "required": ["propertyId"]
  }
}
This will instruct the assistant to return only the
propertyId
in the structured data output, making it easy to use downstream. [See Vapi docs for structured data extraction](https://docs.vapi.ai/assistants/call-analysis#structured-data-schema) Source: - [Call analysis](https://docs.vapi.ai/assistants/call-analysis#structured-data-schema)
c
Use function calling or structured output with a strict JSON schema, or prompt the assistant to return only { "propertyId": <number> } with no extra text..
2 Views