Function Call Request
Server-initiated message requesting a function call, to be handled by either client or server
The FunctionCallRequest message is sent by the Voice Agent server to request a function call. The handling of this call—whether the server executes it or expects the client to—depends on the client_side flag.
Purpose
This message is used to trigger either a built-in server-side function or a custom function defined by the client.
- When
client_sideisfalse, the server will handle the function using built-in logic. - When
client_sideistrue, the client must handle the function and respond with aFunctionCallResponse.
Handling the message
The client_side property is set by the server to indicate where the function should be executed.
When your client receives a FunctionCallRequest:
- Check the
client_sidefield. - If it’s
true, call the appropriate client-defined function. - Return a
FunctionCallResponsemessage with the function result. - If it’s
false, no client action is needed; the server will handle it internally.
Example payload
In this example, the server is requesting that the client execute a function named get_weather with the given arguments.
Related messages
FunctionCallResponse: The expected response from the client whenclient_sideistrue.