toolerr

package
v0.99.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package toolerr maps domain errors onto the agent-facing error object shared by MCP tools and the flowbot CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessExit

func ProcessExit(code string, retryable bool) int

ProcessExit is the CLI process status for a tool error code. Retryable provider_error is 6. Every other unknown code is 1.

Types

type ToolError

type ToolError struct {
	Code         string
	Message      string
	Retryable    bool
	Hint         string
	RetryAfterMS int64
	Field        string
	JobID        string
	Confirmation map[string]any
}

ToolError is the machine-readable failure stored at error in MCP structuredContent and on the CLI stderr envelope.

func ToToolError

func ToToolError(err error) ToolError

ToToolError maps err onto the shared tool error object. Plain errors and ErrInternal become code internal with a fixed message. ErrInvalidArgument keeps the cause text from types.ClientSafeDomainMessage.

func (ToolError) Object

func (e ToolError) Object() map[string]any

Object returns the JSON object for an error envelope. Optional keys are omitted when unset. hint is always present.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL