registry

package
v0.7.17 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry manages the available tools.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new empty registry.

func (*Registry) Execute

func (r *Registry) Execute(ctx context.Context, name string, args map[string]any) (any, error)

Execute looks up a tool by name and executes it. Returns an error if the tool is not found.

func (*Registry) Register

func (r *Registry) Register(name string, fn ToolFunction)

Register adds a tool to the registry. If a tool with the same name exists, it is overwritten.

type ToolFunction

type ToolFunction func(ctx context.Context, args map[string]any) (any, error)

ToolFunction defines the signature for a tool implementation. It receives a context and a map of arguments, and returns a result or error.

Jump to

Keyboard shortcuts

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