Help us shape the future of Go! Take the 2026 Go Developer Survey

tools

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBuiltins

func RegisterBuiltins(r *Registry, opts BuiltinOptions)

func RegisterSubagentTools

func RegisterSubagentTools(r *Registry, m SubagentManager)

Types

type Bash

type Bash struct{}

func (Bash) Run

func (Bash) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (Bash) Spec

func (Bash) Spec() ai.ToolSpec

type BuiltinOptions

type BuiltinOptions struct {
	WebFetchEnabled      bool
	WebFetchAllowPrivate bool
	SearchProvider       search.Provider
	OnRead               func(path string)
}

func BuiltinOptionsFromSettings

func BuiltinOptionsFromSettings(s config.Settings) (BuiltinOptions, string, error)

type CancelSubagent

type CancelSubagent struct{ Manager SubagentManager }

func (CancelSubagent) Run

func (CancelSubagent) Spec

func (CancelSubagent) Spec() ai.ToolSpec

type CodeFindSymbol added in v0.1.16

type CodeFindSymbol struct{}

func (CodeFindSymbol) Run added in v0.1.16

func (CodeFindSymbol) Spec added in v0.1.16

func (CodeFindSymbol) Spec() ai.ToolSpec

type CodeGraphNeighbors added in v0.1.16

type CodeGraphNeighbors struct{}

func (CodeGraphNeighbors) Run added in v0.1.16

func (CodeGraphNeighbors) Spec added in v0.1.16

type CodeIndexSummary added in v0.1.16

type CodeIndexSummary struct{}

func (CodeIndexSummary) Run added in v0.1.16

func (CodeIndexSummary) Spec added in v0.1.16

func (CodeIndexSummary) Spec() ai.ToolSpec

type CodeSymbolContext added in v0.1.16

type CodeSymbolContext struct{}

func (CodeSymbolContext) Run added in v0.1.16

func (CodeSymbolContext) Spec added in v0.1.16

func (CodeSymbolContext) Spec() ai.ToolSpec

type Edit

type Edit struct{}

func (Edit) Run

func (Edit) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (Edit) Spec

func (Edit) Spec() ai.ToolSpec

type GH added in v0.1.11

type GH struct{}

func (GH) Run added in v0.1.11

func (GH) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (GH) Spec added in v0.1.11

func (GH) Spec() ai.ToolSpec

type GetSubagentResult

type GetSubagentResult struct{ Manager SubagentManager }

func (GetSubagentResult) Run

func (GetSubagentResult) Spec

func (GetSubagentResult) Spec() ai.ToolSpec

type GitDiff

type GitDiff struct{}

func (GitDiff) Run

func (GitDiff) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (GitDiff) Spec

func (GitDiff) Spec() ai.ToolSpec

type GitStatus

type GitStatus struct{}

func (GitStatus) Run

func (GitStatus) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (GitStatus) Spec

func (GitStatus) Spec() ai.ToolSpec

type ListFiles

type ListFiles struct{}

func (ListFiles) Run

func (ListFiles) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (ListFiles) Spec

func (ListFiles) Spec() ai.ToolSpec

type ListSubagents

type ListSubagents struct{ Manager SubagentManager }

func (ListSubagents) Run

func (t ListSubagents) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (ListSubagents) Spec

func (ListSubagents) Spec() ai.ToolSpec

type PermissionMode

type PermissionMode string
const (
	PermissionModeAct  PermissionMode = "act"
	PermissionModePlan PermissionMode = "plan"
)

type PlanModeTool

type PlanModeTool interface {
	AllowedInPlanMode() bool
}

PlanModeTool is implemented by tools that explicitly opt in to Plan Mode. Built-in read-only tools are still controlled by the registry allowlist below; this interface is primarily for external/MCP tools, which are denied by default.

type Read

type Read struct {
	// OnRead, if non-nil, is invoked with the resolved path after a successful
	// read. Used by the agent to track FilesRead for repo-map focus.
	OnRead func(path string)
}

func (Read) Run

func (r Read) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (Read) Spec

func (r Read) Spec() ai.ToolSpec

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Clone

func (r *Registry) Clone() *Registry

func (*Registry) CloneForSubagentFull added in v0.1.3

func (r *Registry) CloneForSubagentFull() *Registry

func (*Registry) CloneReadOnly

func (r *Registry) CloneReadOnly() *Registry

func (*Registry) Has

func (r *Registry) Has(name string) bool

func (*Registry) PermissionMode

func (r *Registry) PermissionMode() PermissionMode

func (*Registry) Register

func (r *Registry) Register(t Tool)

func (*Registry) Run

func (r *Registry) Run(ctx context.Context, call ai.ToolCall) (Result, error)

func (*Registry) SetPermissionMode

func (r *Registry) SetPermissionMode(mode PermissionMode)

func (*Registry) Specs

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

func (*Registry) Unregister

func (r *Registry) Unregister(name string)

func (*Registry) UnregisterSubagentTools added in v0.1.3

func (r *Registry) UnregisterSubagentTools()

type Result

type Result struct {
	Output  string
	IsError bool
}

type SearchFiles

type SearchFiles struct{}

func (SearchFiles) Run

func (SearchFiles) Spec

func (SearchFiles) Spec() ai.ToolSpec

type SpawnSubagent

type SpawnSubagent struct{ Manager SubagentManager }

func (SpawnSubagent) Run

func (t SpawnSubagent) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (SpawnSubagent) Spec

func (SpawnSubagent) Spec() ai.ToolSpec

type SpawnSubagentRequest

type SpawnSubagentRequest struct {
	Name         string
	Prompt       string
	AgentType    string
	Background   bool
	Dependencies []string
	TimeoutSecs  int
}

type SubagentManager

type SubagentManager interface {
	Spawn(ctx context.Context, req SpawnSubagentRequest) (*SubagentTask, error)
	List() []SubagentTask
	Get(id string) *SubagentTask
	Cancel(id string) error
}

func DisabledSubagentManager

func DisabledSubagentManager() SubagentManager

type SubagentTask

type SubagentTask struct {
	ID           string     `json:"task_id"`
	Name         string     `json:"name"`
	FamiliarName string     `json:"familiar_name,omitempty"`
	AgentType    string     `json:"agent_type"`
	Status       string     `json:"status"`
	Dependencies []string   `json:"dependencies,omitempty"`
	CreatedAt    time.Time  `json:"created_at"`
	StartedAt    *time.Time `json:"started_at,omitempty"`
	CompletedAt  *time.Time `json:"completed_at,omitempty"`
	InputTokens  int        `json:"input_tokens,omitempty"`
	OutputTokens int        `json:"output_tokens,omitempty"`
	Summary      string     `json:"summary,omitempty"`
	Error        string     `json:"error,omitempty"`
}

type Tool

type Tool interface {
	Spec() ai.ToolSpec
	Run(ctx context.Context, args json.RawMessage) (Result, error)
}

type WebFetch

type WebFetch struct {
	AllowPrivate bool
	Client       *http.Client
}

func (WebFetch) Run

func (w WebFetch) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (WebFetch) Spec

func (w WebFetch) Spec() ai.ToolSpec

type WebSearch

type WebSearch struct{ Provider search.Provider }

func (WebSearch) Run

func (w WebSearch) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (WebSearch) Spec

func (w WebSearch) Spec() ai.ToolSpec

type Write

type Write struct{}

func (Write) Run

func (Write) Run(ctx context.Context, args json.RawMessage) (Result, error)

func (Write) Spec

func (Write) Spec() ai.ToolSpec

Jump to

Keyboard shortcuts

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