tools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tools is the allowlisted, read-only tool set an investigator model uses to look at a target.

The model reads the target through these tools and nothing else. There is no shell, no write and no network tool here, so text planted in the target has nothing to drive. Every path a model supplies goes through walk.Resolve, every result is redacted and then sealed in an envelope, and limits (output size, result counts, line windows) are constants in Go that no argument can raise past their caps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	Root      string           // absolute path of the target root
	Sealer    *envelope.Sealer // wraps every result as untrusted data
	MaxOutput int              // max bytes of content per result; 0 means 24000
}

Env is what tools may touch.

type Registry

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

Registry holds the tools one investigator may call.

func NewNetworkRegistry

func NewNetworkRegistry(sealer *envelope.Sealer) *Registry

NewNetworkRegistry returns a registry with no file tools, for a target that is a running application rather than a directory. Tools are added with Add (the scope-bound http_request tool). Results are still truncated, redacted and enveloped by Call.

func NewRegistry

func NewRegistry(env Env) *Registry

NewRegistry returns the read-only code tools for env: read_file, list_dir, grep, find_symbol, find_references, git_log, git_show.

func (*Registry) Add

func (r *Registry) Add(t Tool)

Add registers an extra tool (used later for http_request). It panics on a duplicate name.

func (*Registry) Call

func (r *Registry) Call(ctx context.Context, call llm.ToolCall) (res llm.ToolResult)

Call runs one tool call and always returns a result (never an error): unknown tool, invalid JSON arguments, unknown argument fields, and tool failures all become IsError results whose text tells the model what to do differently.

func (*Registry) Defs

func (r *Registry) Defs() []llm.ToolDef

Defs returns tool definitions sorted by name.

func (*Registry) Names

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

Names returns registered tool names, sorted.

type Tool

type Tool interface {
	Def() llm.ToolDef
	// Run executes with raw JSON args. A returned error is shown to the model as a tool error.
	Run(ctx context.Context, args json.RawMessage) (string, error)
}

Tool is one callable tool.

Jump to

Keyboard shortcuts

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