Skip to content

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.

new ToolDeniedError(toolName, reason): ToolDeniedError

string

string

ToolDeniedError

AgentExpressError.constructor

readonly optional cause?: Error

Original error that caused this one, if any.

AgentExpressError.cause


code: string

Machine-readable error code (e.g., “ABORT”, “RATE_LIMIT”, “TOOL_DENIED”).

AgentExpressError.code


readonly retryable: boolean

Whether this error can be retried by retry middleware.

AgentExpressError.retryable


readonly toolName: string

Name of the tool that was denied.