Live API - Tool Response for Websockets

After a tool call, the docs say I think I need to send a BidiGenerateContentToolResponse to the weboscket. I do not know the format, and the dosc are unclear. Any help would be appreciated, thanks!

The cookbook here used this, but its not for websockets:
function_response = types.FunctionResponse(
id=fc.id,
name=fc.name,
response={“result”: “ok”},
)

Im trying different variations of this:
tool_response_payload = {
“functionResponse”: {
“functionCallId”: tool_call_id,
“functionName”: tool_name,
}
}

    print(f"📤 Sending tool response: {json.dumps(tool_response_payload, indent=2)}")
    await ws.send(json.dumps(tool_response_payload))

}

Hi @Jason_Yang,

Change your root key to toolResponse and wrap your data in a functionResponses list, because the API requires strictly nested JSON to handle potential parallel function calls.

tool_response_payload = {
"toolResponse": {
"functionResponses": [
{
"id": tool_call_id, # Must match the 'id' from the toolCall message
"name": tool_name, # Name of the function called
"response": {
"result": "ok" # The actual output content (can be any valid JSON object)
}
}
]
}
}

print(f"Sending tool response: {json.dumps(tool_response_payload, indent=2)}")
await ws.send(json.dumps(tool_response_payload))