tools

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BashTool

type BashTool struct {
	WorkDir string
	Timeout time.Duration // default: 2 minutes
}

BashTool executes shell commands. Streams stdout+stderr via ReportToolProgress for real-time display. Final result applies tail truncation (2000 lines / 50KB).

func NewBash

func NewBash(workDir string) *BashTool

func (*BashTool) Description

func (t *BashTool) Description() string

func (*BashTool) Execute

func (t *BashTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)

func (*BashTool) Label

func (t *BashTool) Label() string

func (*BashTool) Name

func (t *BashTool) Name() string

func (*BashTool) Schema

func (t *BashTool) Schema() map[string]any

type EditTool

type EditTool struct{}

EditTool performs exact string replacement in a file. Supports line ending normalization, fuzzy matching, and returns unified diff.

func NewEdit

func NewEdit() *EditTool

func (*EditTool) Description

func (t *EditTool) Description() string

func (*EditTool) Execute

func (t *EditTool) Execute(_ context.Context, args json.RawMessage) (json.RawMessage, error)

func (*EditTool) Label

func (t *EditTool) Label() string

func (*EditTool) Name

func (t *EditTool) Name() string

func (*EditTool) Schema

func (t *EditTool) Schema() map[string]any

type FindTool

type FindTool struct {
	WorkDir string
}

FindTool searches for files matching a glob pattern. Uses fd if available, falls back to filepath.WalkDir + filepath.Match.

func NewFind

func NewFind(workDir string) *FindTool

func (*FindTool) Description

func (t *FindTool) Description() string

func (*FindTool) Execute

func (t *FindTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)

func (*FindTool) Label

func (t *FindTool) Label() string

func (*FindTool) Name

func (t *FindTool) Name() string

func (*FindTool) Schema

func (t *FindTool) Schema() map[string]any

type GrepTool

type GrepTool struct {
	WorkDir string
}

GrepTool searches file contents by pattern. Uses ripgrep (rg) if available, falls back to regexp + bufio.Scanner.

func NewGrep

func NewGrep(workDir string) *GrepTool

func (*GrepTool) Description

func (t *GrepTool) Description() string

func (*GrepTool) Execute

func (t *GrepTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)

func (*GrepTool) Label

func (t *GrepTool) Label() string

func (*GrepTool) Name

func (t *GrepTool) Name() string

func (*GrepTool) Schema

func (t *GrepTool) Schema() map[string]any

type LsTool

type LsTool struct {
	WorkDir string
}

LsTool lists directory contents with optional depth control.

func NewLs

func NewLs(workDir string) *LsTool

func (*LsTool) Description

func (t *LsTool) Description() string

func (*LsTool) Execute

func (t *LsTool) Execute(ctx context.Context, args json.RawMessage) (json.RawMessage, error)

func (*LsTool) Label

func (t *LsTool) Label() string

func (*LsTool) Name

func (t *LsTool) Name() string

func (*LsTool) Schema

func (t *LsTool) Schema() map[string]any

type ReadTool

type ReadTool struct{}

ReadTool reads file contents with optional offset and limit. Applies head truncation (2000 lines / 50KB).

func NewRead

func NewRead() *ReadTool

func (*ReadTool) Description

func (t *ReadTool) Description() string

func (*ReadTool) Execute

func (t *ReadTool) Execute(_ context.Context, args json.RawMessage) (json.RawMessage, error)

func (*ReadTool) Label

func (t *ReadTool) Label() string

func (*ReadTool) Name

func (t *ReadTool) Name() string

func (*ReadTool) Schema

func (t *ReadTool) Schema() map[string]any

type WriteTool

type WriteTool struct{}

WriteTool writes content to a file, creating directories as needed.

func NewWrite

func NewWrite() *WriteTool

func (*WriteTool) Description

func (t *WriteTool) Description() string

func (*WriteTool) Execute

func (t *WriteTool) Execute(_ context.Context, args json.RawMessage) (json.RawMessage, error)

func (*WriteTool) Label

func (t *WriteTool) Label() string

func (*WriteTool) Name

func (t *WriteTool) Name() string

func (*WriteTool) Schema

func (t *WriteTool) Schema() map[string]any

Jump to

Keyboard shortcuts

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