tool

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(msg *types.Message, sessionState service.SessionStateReader) layout.Model

Types

type ComponentBuilder added in v1.8.2

type ComponentBuilder func(
	msg *types.Message,
	sessionState service.SessionStateReader,
) layout.Model

ComponentBuilder is a function that creates a tool component.

type Factory added in v1.8.2

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

Factory creates tool components using the registry. It looks up registered component builders and falls back to a default component if no specific builder is registered for a tool.

func NewFactory added in v1.8.2

func NewFactory(registry *Registry) *Factory

func (*Factory) Create added in v1.8.2

func (f *Factory) Create(msg *types.Message, sessionState service.SessionStateReader) layout.Model

type Registration added in v1.20.1

type Registration struct {
	Names   []string         // Tool names or category prefixes (e.g., "category:api")
	Builder ComponentBuilder // Factory function to create the component
}

Registration pairs tool identifiers with their component builder. Tools with the same visual representation share a builder.

type Registry added in v1.8.2

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

Registry manages tool component builders.

func NewRegistry added in v1.8.2

func NewRegistry() *Registry

func (*Registry) Get added in v1.8.2

func (r *Registry) Get(toolName string) (ComponentBuilder, bool)

func (*Registry) Register added in v1.8.2

func (r *Registry) Register(toolName string, builder ComponentBuilder)

Register adds a single tool-to-builder mapping.

func (*Registry) RegisterAll added in v1.20.1

func (r *Registry) RegisterAll(registrations []Registration)

RegisterAll adds multiple registrations at once. This is the preferred way to set up the registry declaratively.

Jump to

Keyboard shortcuts

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