tool

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractHint added in v0.7.0

func ExtractHint(argsJSON, toolName string) string

ExtractHint returns a short, human-readable summary of a tool call's input, suitable as a one-line UI label (e.g. "edit: /foo.go", "grep: pattern", "shell: build description"). The result is the bare value — callers usually prefix it with the tool name. Used by every UI surface (TUI, web UI live stream, web UI replay) so the same call renders identically everywhere.

func IntArg added in v0.6.9

func IntArg(args map[string]any, key string) (int, bool)

func IntValue added in v0.6.9

func IntValue(value any) (int, bool)

func NonNegIntArg added in v0.6.9

func NonNegIntArg(args map[string]any, key string) (value int, present bool, err error)

NonNegIntArg reads an optional non-negative integer. Returns present=false when the key is absent; returns an error when the value is present but not a non-negative integer. The error message names the key so callers can surface it without further wrapping.

func OptionalIntArg added in v0.6.9

func OptionalIntArg(args map[string]any, key string) (int, bool, error)

func PositiveIntArg added in v0.6.9

func PositiveIntArg(args map[string]any, key string) (value int, present bool, err error)

PositiveIntArg reads an optional strictly-positive integer (>= 1). Same contract as NonNegIntArg.

func StaticEffect added in v0.6.2

func StaticEffect(effect Effect) func(map[string]any) Effect

Types

type Effect added in v0.6.2

type Effect string
const (
	EffectReadOnly  Effect = "read_only"
	EffectMutates   Effect = "mutates"
	EffectDangerous Effect = "dangerous"
	EffectDynamic   Effect = "dynamic"
)

type Elicitation added in v0.6.2

type Elicitation struct {
	Ask     func(ctx context.Context, message string) (string, error)
	Confirm func(ctx context.Context, message string) (bool, error)
}

type Tool

type Tool struct {
	Name        string
	Description string
	Parameters  map[string]any
	Execute     func(ctx context.Context, args map[string]any) (string, error)
	Hidden      bool
	Effect      func(args map[string]any) Effect
}

type ToolCall added in v0.6.2

type ToolCall struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Args string `json:"args,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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