Issue with tool response formatting — bot not recognizing returned values
I have the tool:
{
"id": "71276008-3da2-48c6-bc80-31b3b9d0d63d",
"createdAt": "2025-06-14T20:16:34.394Z",
"updatedAt": "2025-07-01T19:00:26.225Z",
"type": "function",
"function": {
"name": "search_patient",
"strict": false,
"parameters": {
"type": "object",
"properties": {
"phone": {
"description": "",
"type": "string"
},
"full_name": {
"description": "",
"type": "string"
}
},
"required": []
}
},
"messages": [
{
"role": "assistant",
"type": "request-complete",
"content": "I have found patient {{result.full_name}}. The phone number is: {{result.phone}}. Do you want to schedule an appointment?",
"conditions": [
{
"param": "result",
"value": """",
"operator": "neq"
}
],
"endCallAfterSpokenEnabled": false
}
],
"orgId": "577d690d-6bc1-40e5-ba66-2baad1505f3f",
"async": true
}
i send the information like that:
search_patient (call_id=call_A08xtsnYWKkBaWZca0ZPb2yS): {"full_name": "Name"})
-->
{'results': [{'toolCallId': 'call_A08xtsnYWKkBaWZca0ZPb2yS', 'result': 'full name: "Some Name", "phone: +5555555555"}]}
The assistant responds incorrectly — sometimes inventing a random phone number (e.g. counting digits from 1 to 0), or acting as if no data was provided at all (e.g. asking for more information again).
Could you please clarify:
Is this the correct way to return structured results with multiple fields?
Should I be placing result.full_name and result.phone inside the "result" field as a JSON object, or should I flatten the response?
Are there any required metadata fields (like success) that I might be missing?
Thank you!
{
"id": "71276008-3da2-48c6-bc80-31b3b9d0d63d",
"createdAt": "2025-06-14T20:16:34.394Z",
"updatedAt": "2025-07-01T19:00:26.225Z",
"type": "function",
"function": {
"name": "search_patient",
"strict": false,
"parameters": {
"type": "object",
"properties": {
"phone": {
"description": "",
"type": "string"
},
"full_name": {
"description": "",
"type": "string"
}
},
"required": []
}
},
"messages": [
{
"role": "assistant",
"type": "request-complete",
"content": "I have found patient {{result.full_name}}. The phone number is: {{result.phone}}. Do you want to schedule an appointment?",
"conditions": [
{
"param": "result",
"value": """",
"operator": "neq"
}
],
"endCallAfterSpokenEnabled": false
}
],
"orgId": "577d690d-6bc1-40e5-ba66-2baad1505f3f",
"async": true
}
i send the information like that:
search_patient (call_id=call_A08xtsnYWKkBaWZca0ZPb2yS): {"full_name": "Name"})
-->
{'results': [{'toolCallId': 'call_A08xtsnYWKkBaWZca0ZPb2yS', 'result': 'full name: "Some Name", "phone: +5555555555"}]}
The assistant responds incorrectly — sometimes inventing a random phone number (e.g. counting digits from 1 to 0), or acting as if no data was provided at all (e.g. asking for more information again).
Could you please clarify:
Is this the correct way to return structured results with multiple fields?
Should I be placing result.full_name and result.phone inside the "result" field as a JSON object, or should I flatten the response?
Are there any required metadata fields (like success) that I might be missing?
Thank you!