Skip to main content
Client tools let an agent trigger actions in the connected application, such as opening a page or reading client-side state. They are available only over the WebSocket API. When the model invokes a client tool, the server sends a client_tool_call event to the connected browser, mobile app, or server. After running the function, that connected client sends client_tool_result to the server when a response is required.

Define a client tool

Create the tool with POST /v1/agents/tools, then attach its ID through config.tools. See Tools for the shared execution settings.

Parameters

parameters must be a JSON Schema object. Properties may use string, integer, number, boolean, or an array of one of those scalar types. Use enum inside a string property to list its allowed string values. Use required to identify values the model must supply.

Response behavior

  • expects_response: true makes the agent wait for a client_tool_result with the same tool_call_id. Use it when the result affects the conversation.
  • expects_response: false completes the tool after dispatch. Use it for client-side actions that the agent does not need to confirm.
When expects_response is true, Cartesia waits up to response_timeout_secs for the result. If no result arrives, Cartesia automatically supplies Tool call timed out to the LLM. To report its own failure, the connected client sends a result with is_error: true and an optional error_type.

Handle a tool call

Results are strings up to 4096 bytes. On failure, send is_error: true with a short result that the LLM can act on. The result is what the LLM receives. The optional error_type accepts a free-form string up to 256 UTF-8 bytes, such as timeout; a longer value discards the result as well. See the WebSocket event reference for complete event schemas.