The agent run that triggered this request
When set to true by any synchronous subscriber, the session will short-circuit
dispatch: no tool handler runs, ToolExecuted$ is NOT emitted, and a failure
response is sent to the server. Defaults to false (proceed with dispatch).
OptionalCancelOptional human-readable reason set alongside Cancel = true. Surfaced in the
server-side error message (Tool dispatch canceled by host: <reason>) so the
agent can adapt its next turn.
The raw request from the server
Event emitted when a client tool request is received from the server. Raised BEFORE execution — subscribers can observe what tools are being invoked, AND veto the dispatch by setting
Cancel = true(cancel-enforcement).Cancel semantics: the host's RxJS subscriber runs synchronously inside the
Subject.next()call. After the synchronous notify completes, AgentClientSession.handleToolRequest readsevent.Cancel; iftrue, the tool handler is NOT executed, AgentClientSession.ToolExecuted$ does NOT fire, and a failure result is sent back to the server withTool dispatch canceled by host[: <CancelReason>]as the error message.Use cases: permission/role gates, destructive-action confirmation dialogs, rate-limit caps, and other host-side policy decisions that must run before a tool side-effect happens. For pure observation (analytics, logging), leave
Cancelat its defaultfalse.