Documentation
¶
Overview ¶
Package toolerrors provides structured error types for tool invocation failures. ToolError preserves error chains and supports errors.Is/As while maintaining serialization compatibility for agent-as-tool scenarios.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ToolError ¶
type ToolError struct {
// Message is the human-readable summary of the failure.
Message string
// Cause links to the underlying tool error, enabling error chains with errors.Is/As.
Cause *ToolError
}
ToolError represents a structured tool failure that preserves message and causal context while still implementing the standard error interface. Tool errors may be nested via Cause to retain rich diagnostics across retries and agent-as-tool hops.
func New ¶
New constructs a ToolError with the provided message. Use when the failure does not wrap an underlying error but still requires structured reporting.
func NewWithCause ¶
NewWithCause constructs a ToolError that wraps an underlying error. The cause is converted into a ToolError chain so error metadata survives serialization while still supporting errors.Is/As through Unwrap.