When handling client-side tool calls, is there a recommended way to propagate a user denial in the same way as with server-side tool calls?
I noticed that UIToolInvocation state seems to include output-denied, but it doesn’t appear that this can be set via addToolOutput().
Would addToolApprovalResponse() be the correct approach here?
However, that function seems to be intended only for server-side tool calls.
Alternatively, if I return an appropriate error via addToolOutput(), will the LLM properly interpret that as the tool invocation being denied by the user?
The ‘output-denied’ state you noticed in UIToolInvocation is an internal state used by the framework, not something you can set directly. For client-side tools, you can use the output-error state:
That tells the LLM that the tool execution failed, and it will handle it appropriately. This is semantically correct since from the tool’s perspective, a user denial is effectively an execution failure.