toolset

package
v0.2.1-alpha.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HintFor

func HintFor(name tools.ToolName) string

HintFor returns the curated search hint for a tool name, or "" if none is declared. Safe to call for unknown names — returns "".

func TagsFor

func TagsFor(name tools.ToolName) []string

TagsFor returns the keywords associated with a tool name, or nil if none are declared. Safe to call for unknown names — returns nil.

Types

type Registry

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

Registry maps tool names to factories. Downstream apps register their own tools by calling DefaultRegistry().Register at startup before the first agent is constructed; evva's bundled tools are registered by internal/toolset during init.

Registry is safe for concurrent use. Register fails on duplicate names — silently overwriting would let a typo route an LLM-facing name to the wrong implementation. Use MustRegister at init time when a duplicate is a programming bug.

func DefaultRegistry

func DefaultRegistry() *Registry

DefaultRegistry returns the process-wide registry. Pre-population is the caller's responsibility — evva's bundled tools register themselves via internal/toolset's init function (which cmd/evva imports transitively through internal/agent). Downstream apps consume the same registry to register custom tools:

toolset.DefaultRegistry().Register("my_tool", myFactory)

before the first agent is constructed.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty registry. Most callers want DefaultRegistry instead — it's the one evva's bundled tools register into.

func (*Registry) Build

func (r *Registry) Build(name tools.ToolName, state tools.State) (tools.Tool, error)

Build instantiates the named tool against state. Returns an error for unregistered names — there is no silent fallback.

func (*Registry) Has

func (r *Registry) Has(name tools.ToolName) bool

Has reports whether name is registered.

func (*Registry) MustRegister

func (r *Registry) MustRegister(name tools.ToolName, factory ToolFactory)

MustRegister wraps Register and panics on error. Use only at init time where a duplicate or nil factory is a programmer bug.

func (*Registry) Names

func (r *Registry) Names() []tools.ToolName

Names returns every registered name, sorted lexicographically. Useful for tests + diagnostic output. Mutating the returned slice is safe.

func (*Registry) Register

func (r *Registry) Register(name tools.ToolName, factory ToolFactory) error

Register associates a factory with a tool name. Returns an error if name is already registered or factory is nil.

type ToolFactory

type ToolFactory func(state tools.State) (tools.Tool, error)

ToolFactory builds one tool instance against the supplied state. The state parameter exposes the per-agent runtime config and workdir; evva-internal factories type-assert it to the concrete internal/toolset.ToolState to reach private accessors (ReadTracker, subagent spawner, etc.).

Factories must not retain the State beyond the call — the tool itself either captures the late-binding closures it needs (e.g. the AGENT tool's spawner lookup) or holds the cfg / workdir values it received.

Jump to

Keyboard shortcuts

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