tools

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const MaxBashOutputBytes = 256 * 1024

MaxBashOutputBytes bounds command output in memory while leaving enough of both ends to diagnose failures. The agent applies its own final transcript cap, but the tool must not buffer an unbounded command before reaching it.

View Source
const MaxReadBytes = 256 * 1024

MaxReadBytes caps the total bytes ReadFile will return in a single call. Files larger than this must be paged via offset/limit.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bash

type Bash struct {
	Timeout time.Duration
	CWD     string
}

func (Bash) Name

func (Bash) Name() string

func (Bash) Run

func (b Bash) Run(ctx context.Context, input map[string]any) (string, error)

func (Bash) Spec

func (Bash) Spec() llm.ToolSpec

type EditFile

type EditFile struct{}

func (EditFile) Name

func (EditFile) Name() string

func (EditFile) Run

func (EditFile) Run(ctx context.Context, input map[string]any) (string, error)

func (EditFile) Spec

func (EditFile) Spec() llm.ToolSpec

type Glob added in v0.2.0

type Glob struct {
	Root string
}

func (Glob) Name added in v0.2.0

func (Glob) Name() string

func (Glob) Run added in v0.2.0

func (g Glob) Run(ctx context.Context, input map[string]any) (string, error)

func (Glob) Spec added in v0.2.0

func (Glob) Spec() llm.ToolSpec

type Grep added in v0.2.0

type Grep struct {
	Root string
}

func (Grep) Name added in v0.2.0

func (Grep) Name() string

func (Grep) Run added in v0.2.0

func (g Grep) Run(ctx context.Context, input map[string]any) (string, error)

func (Grep) Spec added in v0.2.0

func (Grep) Spec() llm.ToolSpec

type ReadFile

type ReadFile struct{}

func (ReadFile) Name

func (ReadFile) Name() string

func (ReadFile) Run

func (ReadFile) Run(ctx context.Context, input map[string]any) (string, error)

func (ReadFile) Spec

func (ReadFile) Spec() llm.ToolSpec

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(ts ...Tool) *Registry

func (*Registry) Filter

func (r *Registry) Filter(names []string) *Registry

func (*Registry) Get

func (r *Registry) Get(name string) (Tool, bool)

func (*Registry) Names added in v0.2.0

func (r *Registry) Names() []string

func (*Registry) Specs

func (r *Registry) Specs() []llm.ToolSpec

type Tool

type Tool interface {
	Name() string
	Spec() llm.ToolSpec
	Run(ctx context.Context, input map[string]any) (string, error)
}

type WriteFile

type WriteFile struct{}

func (WriteFile) Name

func (WriteFile) Name() string

func (WriteFile) Run

func (WriteFile) Run(ctx context.Context, input map[string]any) (string, error)

func (WriteFile) Spec

func (WriteFile) Spec() llm.ToolSpec

Jump to

Keyboard shortcuts

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