ToolDeniedError
Thrown when ctx.deny(reason) is called in a tool hook.
This is a soft failure — the tool is not executed, and the LLM receives an error message so it can try a different approach. Does not unwind the stack.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ToolDeniedError(
toolName,reason):ToolDeniedError
Parameters
Section titled “Parameters”toolName
Section titled “toolName”string
reason
Section titled “reason”string
Returns
Section titled “Returns”ToolDeniedError
Overrides
Section titled “Overrides”Properties
Section titled “Properties”cause?
Section titled “cause?”
readonlyoptionalcause?:Error
Original error that caused this one, if any.
Inherited from
Section titled “Inherited from”code:
string
Machine-readable error code (e.g., “ABORT”, “RATE_LIMIT”, “TOOL_DENIED”).
Inherited from
Section titled “Inherited from”retryable
Section titled “retryable”
readonlyretryable:boolean
Whether this error can be retried by retry middleware.
Inherited from
Section titled “Inherited from”toolName
Section titled “toolName”
readonlytoolName:string
Name of the tool that was denied.