builtins

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package builtins provides built-in tools available to all agents.

Index

Constants

View Source
const (
	// MaxOutputLines is the maximum number of lines returned by tool output.
	MaxOutputLines = 2000
	// MaxOutputBytes is the maximum size of tool output in bytes.
	MaxOutputBytes = 50 * 1024
)

Variables

This section is empty.

Functions

func All

func All() []tools.Tool

All returns all built-in tools.

func CodeAgentReadTools

func CodeAgentReadTools(workDir string) []tools.Tool

CodeAgentReadTools returns read-only coding tools (file_read + search).

func CodeAgentSearchTools

func CodeAgentSearchTools(workDir string) []tools.Tool

CodeAgentSearchTools returns search/exploration tools (grep, glob, tree). These are safe read-only tools for exploring codebases.

func CodeAgentTools

func CodeAgentTools(workDir string) []tools.Tool

CodeAgentTools returns all coding agent tools (read + write).

func CodeAgentWriteTools

func CodeAgentWriteTools(workDir string) []tools.Tool

CodeAgentWriteTools returns write/execute tools.

func GetByName

func GetByName(name string) tools.Tool

GetByName returns a built-in tool by name, or nil if not found.

func MimeFromExtension

func MimeFromExtension(ext string) string

MimeFromExtension returns the MIME type for a given file extension. Returns empty string if the extension is not in the allowlist.

func NewMemoryGetTool

func NewMemoryGetTool(mgr *memory.Manager) tools.Tool

NewMemoryGetTool creates a memory_get tool backed by a Manager. This tool is registered conditionally (not via All()) since it needs a Manager instance.

func NewMemorySearchTool

func NewMemorySearchTool(mgr *memory.Manager) tools.Tool

NewMemorySearchTool creates a memory_search tool backed by a Manager. This tool is registered conditionally (not via All()) since it needs a Manager instance.

func NewScheduleDeleteTool

func NewScheduleDeleteTool(store scheduler.ScheduleStore, reloader ScheduleReloader) tools.Tool

NewScheduleDeleteTool creates a schedule_delete tool for removing schedules.

func NewScheduleHistoryTool

func NewScheduleHistoryTool(store scheduler.ScheduleStore) tools.Tool

NewScheduleHistoryTool creates a schedule_history tool for viewing execution history.

func NewScheduleListTool

func NewScheduleListTool(store scheduler.ScheduleStore) tools.Tool

NewScheduleListTool creates a schedule_list tool for listing schedules.

func NewScheduleSetTool

func NewScheduleSetTool(store scheduler.ScheduleStore, reloader ScheduleReloader) tools.Tool

NewScheduleSetTool creates a schedule_set tool for creating/updating schedules.

func RegisterAll

func RegisterAll(reg *tools.Registry) error

RegisterAll registers all built-in tools with the given registry.

func RegisterCodeAgentReadTools

func RegisterCodeAgentReadTools(reg *tools.Registry, workDir string) error

RegisterCodeAgentReadTools registers only the read-only coding tools.

func RegisterCodeAgentSearchTools

func RegisterCodeAgentSearchTools(reg *tools.Registry, workDir string) error

RegisterCodeAgentSearchTools registers search/exploration tools.

func RegisterCodeAgentTools

func RegisterCodeAgentTools(reg *tools.Registry, workDir string) error

RegisterCodeAgentTools registers all coding agent tools with the given registry.

func RegisterCodeAgentWriteTools

func RegisterCodeAgentWriteTools(reg *tools.Registry, workDir string) error

RegisterCodeAgentWriteTools registers the write/execute coding tools.

func TruncateOutput

func TruncateOutput(s string) string

TruncateOutput truncates a string to MaxOutputLines and MaxOutputBytes, appending a truncation notice if the output was trimmed.

Types

type PathValidator

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

PathValidator provides path confinement to a working directory. All resolved paths are guaranteed to be within workDir.

func NewPathValidator

func NewPathValidator(workDir string) *PathValidator

NewPathValidator creates a PathValidator for the given working directory.

func (*PathValidator) Resolve

func (v *PathValidator) Resolve(path string) (string, error)

Resolve converts a relative or absolute path to an absolute path within workDir. It returns an error if the resolved path escapes the working directory.

func (*PathValidator) WorkDir

func (v *PathValidator) WorkDir() string

WorkDir returns the absolute working directory.

type ReadSkillTool

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

ReadSkillTool reads a skill's SKILL.md file on demand. This enables lazy-loading: the LLM only loads full skill instructions when it decides a skill is relevant.

func NewReadSkillTool

func NewReadSkillTool(workDir string) *ReadSkillTool

NewReadSkillTool creates a read_skill tool rooted at the given working directory.

func (*ReadSkillTool) Category

func (t *ReadSkillTool) Category() tools.Category

func (*ReadSkillTool) Description

func (t *ReadSkillTool) Description() string

func (*ReadSkillTool) Execute

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

func (*ReadSkillTool) InputSchema

func (t *ReadSkillTool) InputSchema() json.RawMessage

func (*ReadSkillTool) Name

func (t *ReadSkillTool) Name() string

type ScheduleReloader

type ScheduleReloader interface {
	Reload(ctx context.Context)
}

ScheduleReloader is the interface for reloading the scheduler after changes.

Jump to

Keyboard shortcuts

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