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

tool

package
v1.49.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 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

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

ComponentBuilder is a function that creates a tool component.

type Factory

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

func NewFactory(registry *Registry) *Factory

func (*Factory) Create

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

type Registration

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

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

Registry manages tool component builders.

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Get

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

func (*Registry) Register

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

Register adds a single tool-to-builder mapping.

func (*Registry) RegisterAll

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