tools

package
v0.1.5 Latest Latest
Warning

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

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

Documentation

Overview

Package tools provides a centralized tool registry that bootstraps all tools from various integration points (file, shell, browser, MCP, etc.) and filters denied tools based on HITL configuration. This is the single source of truth for which tools are available to the orchestrator and sub-agents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewShellTool

func NewShellTool(executor codeexecutor.CodeExecutor) tool.Tool

Types

type FileToolProvider

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

FileToolProvider wraps a trpc-agent-go file.ToolSet and satisfies the ToolProviders interface. The tools are pre-computed at construction time because file.ToolSet.Tools requires a context.

func NewFileToolProvider

func NewFileToolProvider(ctx context.Context, workingDir string) *FileToolProvider

NewFileToolProvider creates a ToolProvider for file tools scoped to a working directory. Returns nil if the ToolSet fails to initialise.

func (*FileToolProvider) GetTools

func (p *FileToolProvider) GetTools() []tool.Tool

GetTools returns the pre-computed file tools.

type PensieveToolProvider

type PensieveToolProvider struct{}

PensieveToolProvider wraps the Pensieve context management tools (delete_context, check_budget, note, read_notes) and satisfies the ToolProviders interface. Gated behind EnablePensieve in config.

func NewPensieveToolProvider

func NewPensieveToolProvider() *PensieveToolProvider

NewPensieveToolProvider creates a ToolProvider for the Pensieve tools.

func (*PensieveToolProvider) GetTools

func (p *PensieveToolProvider) GetTools() []tool.Tool

GetTools returns the context management tools.

type Registry

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

Registry holds the bootstrapped, filtered set of tools.

func NewRegistry

func NewRegistry(ctx context.Context, providers ...ToolProviders) *Registry

NewRegistry collects tools from every supplied ToolProviders conformer. The returned Registry provides the aggregated tool list via AllTools(). Use FilterDenied to subsequently exclude tools blocked by HITL config.

func (*Registry) AllTools

func (r *Registry) AllTools() Tools

AllTools is a convenience alias for GetTools. Prefer AllTools when calling from application code for readability; GetTools exists to satisfy the ToolProviders interface.

func (*Registry) Exclude

func (r *Registry) Exclude(names ...string) *Registry

Exclude returns a new Registry that omits tools with the given names. Used to strip orchestration-only tools (e.g. create_agent, send_message) before passing the registry to sub-agents.

func (*Registry) FilterDenied

func (r *Registry) FilterDenied(ctx context.Context, cfg hitl.Config) *Registry

FilterDenied returns a new Registry that excludes any tools denied by the HITL config. This is the single place where tool-level deny-listing is applied. Without this, denied tools would still be available to agents.

func (*Registry) GetTool

func (r *Registry) GetTool(name string) (tool.Tool, error)

func (*Registry) GetToolDescriptions

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

func (*Registry) GetTools

func (r *Registry) GetTools() []tool.Tool

GetTools returns the full set of available (non-denied) tools. Satisfies the ToolProviders interface so a Registry can be passed as a provider to another Registry (e.g. codeOwner tools).

func (*Registry) Include

func (r *Registry) Include(names ...string) *Registry

Include returns a new Registry containing only tools whose names appear in the provided list. Unknown names are silently ignored. If names is empty, the original Registry is returned unchanged (all tools available). Used to scope sub-agents to exactly the tools the planner selected.

func (*Registry) ToolNames

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

ToolNames returns the names of all available tools (for logging).

type ShellTool

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

ShellTool is a simplified tool for running shell commands. It wraps a codeexecutor.CodeExecutor but exposes a simpler "command" interface that is friendlier to models than the full codeexec.Tool.

func (*ShellTool) Call

func (t *ShellTool) Call(ctx context.Context, input []byte) (any, error)

func (*ShellTool) Declaration

func (t *ShellTool) Declaration() *tool.Declaration

type ShellToolProvider

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

ShellToolProvider wraps the shell tool and satisfies the ToolProviders interface. It encapsulates code executor configuration.

func NewShellToolProvider

func NewShellToolProvider(workingDir string) *ShellToolProvider

NewShellToolProvider creates a ToolProvider for the shell_exec tool.

func (*ShellToolProvider) GetTools

func (p *ShellToolProvider) GetTools() []tool.Tool

GetTools returns the shell tool backed by a local code executor.

type ToolProviders

type ToolProviders interface {
	GetTools() []tool.Tool
}

ToolProviders is the interface that all tool-producing types must satisfy in order to be passed to NewRegistry. Each provider is responsible for constructing its own tools from whatever dependencies it holds.

type Tools

type Tools []tool.Tool

Slice is a convenience adapter that wraps a plain []tool.Tool into a ToolProviders conformer. Useful for ad-hoc tool collections that don't belong to a dedicated package (e.g. the codeowner's orchestration-only tool set).

func (Tools) GetTools

func (s Tools) GetTools() []tool.Tool

GetTools returns the wrapped slice of tools.

Directories

Path Synopsis
Package codeskim provides a code outline/skimming tool for agents.
Package codeskim provides a code outline/skimming tool for agents.
Package datetime provides time and date tools for agents.
Package datetime provides time and date tools for agents.
Package doctool provides document parsing tools for agents.
Package doctool provides document parsing tools for agents.
Package encodetool provides encoding, decoding, and hashing tools for agents.
Package encodetool provides encoding, decoding, and hashing tools for agents.
google
calendar
Package calendar provides calendar management tools for agents.
Package calendar provides calendar management tools for agents.
contacts
Package contacts provides Google Contacts (People API) tools for agents.
Package contacts provides Google Contacts (People API) tools for agents.
gdrive
Package gdrive provides a DataSource connector that enumerates Google Drive files in configured folders for vectorization.
Package gdrive provides a DataSource connector that enumerates Google Drive files in configured folders for vectorization.
gdrive/gdrivefakes
Code generated by counterfeiter.
Code generated by counterfeiter.
gmail
Package gmail provides a DataSource connector that enumerates Gmail messages for given labels for vectorization.
Package gmail provides a DataSource connector that enumerates Gmail messages for given labels for vectorization.
oauth
Package oauth: browser_flow runs the OAuth2 authorization code flow by opening the system browser and running a local redirect server to capture the code, then exchanging it for a token and storing it in the device keyring.
Package oauth: browser_flow runs the OAuth2 authorization code flow by opening the system browser and running a local redirect server to capture the code, then exchanging it for a token and storing it in the device keyring.
tasks
Package tasks provides Google Tasks API tools for agents.
Package tasks provides Google Tasks API tools for agents.
Package jsontool provides JSON querying, validation, and transformation tools backed by gjson (reads) and sjson (writes).
Package jsontool provides JSON querying, validation, and transformation tools backed by gjson (reads) and sjson (writes).
Package math provides mathematical tools (a unified arithmetic tool and a calculator/expression evaluator) that can be registered with the tool registry.
Package math provides mathematical tools (a unified arithmetic tool and a calculator/expression evaluator) that can be registered with the tool registry.
Package networking provides agent-callable tools for making HTTP requests (GET, POST, etc.) to arbitrary URLs with configurable headers, body, and timeout.
Package networking provides agent-callable tools for making HTTP requests (GET, POST, etc.) to arbitrary URLs with configurable headers, body, and timeout.
Package ocrtool provides optical character recognition (OCR) tools for agents.
Package ocrtool provides optical character recognition (OCR) tools for agents.
pm
Package pm provides a DataSource connector for issue-tracking systems.
Package pm provides a DataSource connector for issue-tracking systems.
pmfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Package regextool provides regular expression tools for agents.
Package regextool provides regular expression tools for agents.
scm
Package scm provides a single DataSource connector backed by go-scm for all SCM providers (GitHub, GitLab, Bitbucket).
Package scm provides a single DataSource connector backed by go-scm for all SCM providers (GitHub, GitLab, Bitbucket).
scmfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Package sqltool provides SQL database query tools for agents.
Package sqltool provides SQL database query tools for agents.
Code generated by counterfeiter.
Code generated by counterfeiter.
Package webfetch provides a URL content fetcher for agents.
Package webfetch provides a URL content fetcher for agents.
Package youtubetranscript provides a tool to fetch transcript/captions from YouTube videos.
Package youtubetranscript provides a tool to fetch transcript/captions from YouTube videos.

Jump to

Keyboard shortcuts

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