Issue with tool response formatting — bot not reco...
# support
a
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!
k
Return a JSON object with
results
as an array containing the correct
toolCallId
and a structured
result
object like `{ "full_name": "...", "phone": "..." }`; no extra fields like
success
are needed, and formatting must be valid JSON with the proper
Content-Type
..
a
and how should I use variables when i tune my tool? {{full_name}} or {{result.full_name}} or {{results[0].result.full_name}}
im asking cos i have already tried json formatting and it didnt work for me aswell
k
Use {{full_name}} just the variable name defined in variableValues, don’t use {{result.full_name}} or nested paths..
a
So now i edited my tool function like that: { "id": "71276008-3da2-48c6-bc80-31b3b9d0d63d", "createdAt": "2025-06-14T20:16:34.394Z", "updatedAt": "2025-07-02T19:41:01.675Z", "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 {{full_name}}. The phone number is: {{phone}}. Do you want to schedule an appointment?", "conditions": [ { "param": "full_name", "value": "\"\"", "operator": "neq" } ], "endCallAfterSpokenEnabled": false }, { "type": "request-start", "content": "Please wait a second, i am checking our database.", "blocking": true, "conditions": [ { "param": "full_name", "value": "\"\"", "operator": "neq" } ] }, { "type": "request-response-delayed", "content": "I am facing some delay, sorry for that.", "timingMilliseconds": 2000 }, { "type": "request-failed", "content": "For some reason my attempt to find you failed.", "endCallAfterSpokenEnabled": false } ], "orgId": "577d690d-6bc1-40e5-ba66-2baad1505f3f", "async": true } I send: search_patient (call_id=call_Hb1zjPMFtbzARVdfcxrkFjQY): {"full_name": "Artur"} {'results': [{'toolCallId': 'call_Hb1zjPMFtbzARVdfcxrkFjQY', 'result': {'full_name': 'Artur Valuev', 'phone': '+14355577709'}}]}
And bot answers me: Bot: Thank you for calling Vera Dental of Riverton. This is Robin, your health care coordinator. Caller: Hello. Please provide me with the information about patient Artur. Bot: I have found patient Artur. Bot: The phone number is do you want to schedule an appointment?
So it fails to use variable it got from my backend and just skips it
c
Hey @archpunch, you have to return the result in string format only. The tool call result or custom tool expects the result property to be of type string only without any line breaks. If you return a JSON object, you need to stringify it first and then return it. Finally, either using the tool description or system prompt, you need to instruct the LLM on how to use your tool call result.
a
As i showed below, string object also isnt working. I have tried all the combinations.
I have such system prompt
Some help there?
c
Hey @archpunch looking into it.
s
@archpunch can you share a recent call_id where your returning the response as stringified?
a
call_A08xtsnYWKkBaWZca0ZPb2yS
c
I'm sorry to hear you're having this issue. Could you please provide a call ID where you experienced this? We want to review the logs to identify the cause.
a
have alreadt provided
c
Hi, sorry it's taking longer than usual. Our team is looking into it and will get back to you with an update soon.
a
Some unsolvable problem?
c
Hey archpunch, Thanks for reaching out! We're currently swamped with a bunch of tickets and it's taking us longer than usual to get back to everyone. I know waiting isn't fun, but we want to make sure we give your issue the attention it deserves rather than rushing through it. We'll circle back with you soon to get this sorted out.
a
ad90d6ab-dcac-4989-b076-268507d3d66a call id from ui
c
Hey, I checked with our team, and they mentioned that no tool call was triggered for the call ID ad90d6ab-dcac-4989-b076-268507d3d66a.
a
I can literally see that tool call was triggered in the call transcription. How can I speak with real person but not the bot?
c
Hey, let me check with our team and get back to you with an update.