?
session.registerClientTool
Registers a browser-side handler for a client tool the agent can invoke.
session.registerClientTool(name, handler) → () => void
Registers the browser handler for a client tool: a tool declared with target: "client" whose effect lives on screen (open a sheet, navigate, highlight). When the agent invokes it, the handler runs and its return value goes back to the agent as the tool result, a real request and response, so the agent knows the action happened and speaks accordingly. One handler per name; the agent waits up to about thirty seconds. It returns an unregister function.
Parameters
name
string
RequiredThe client tool's name, matching the one declared in the voice spec.
handler
(args) => unknown | Promise<unknown>
RequiredRuns when the agent invokes the tool; its return value goes back to the agent as the result.
Open a sheet on the agent's request
const off = session.registerClientTool('showVerification', async ({ reason }) => { openVerifySheet(reason); return { opened: true }; // what the agent hears back });