ToolError
An intentional, model-visible tool error.
Never include secret values or internal stack traces in the message — it is visible to the model and potentially the user. Describe the problem at the level of the tool’s semantics, not the implementation.
Example
Section titled “Example”throw new ToolError(`Order ${orderId} not found`, { retryable: false });Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ToolError(message: string, options?: ToolErrorOptions): ToolError;Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
message | string | Human-readable, model-safe error message. |
options? | ToolErrorOptions | Optional retryable hint and structured data. |
Returns
Section titled “Returns”ToolError
Overrides
Section titled “Overrides”Error.constructor