retry

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package retry defines shared types and helpers for producing standardized retryable errors and compact repair prompts used across generated clients.

Generated clients wrap transport errors for invalid parameters into RetryableError with a Prompt intended for LLM-driven correction. The LLM is expected to redo the same operation (e.g., JSON-RPC tools/call for MCP tools) with valid parameters based on the prompt constraints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRepairPrompt

func BuildRepairPrompt(op string, errMsg string, exampleJSON string, schema string) string

BuildRepairPrompt constructs a deterministic, compact repair instruction. schema is an optional compact JSON schema excerpt; exampleJSON is a minimal valid example of the params payload.

Types

type RetryableError

type RetryableError struct {
	Prompt string
	Cause  error
}

RetryableError is returned by clients when the server reports invalid parameters and a structured repair prompt is available.

Prompt is human-readable and designed for LLM-driven correction. Typical flow:

  1. Present Prompt to the LLM
  2. Capture the JSON-only corrected params
  3. Decode into the operation payload type
  4. Retry the same operation

func (*RetryableError) Error

func (e *RetryableError) Error() string

Error returns the error message.

Jump to

Keyboard shortcuts

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