registry

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package registry provides toolkit registration and management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBuiltinFactories

func RegisterBuiltinFactories(r *Registry)

RegisterBuiltinFactories registers all built-in toolkit factories.

Types

type Loader

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

Loader loads toolkits from configuration.

func NewLoader

func NewLoader(registry *Registry) *Loader

NewLoader creates a new toolkit loader.

func (*Loader) Load

func (l *Loader) Load(cfg LoaderConfig) error

Load loads toolkits from configuration.

func (*Loader) LoadFromMap

func (l *Loader) LoadFromMap(toolkits map[string]any) error

LoadFromMap loads toolkits from a map configuration.

type LoaderConfig

type LoaderConfig struct {
	Toolkits map[string]ToolkitKindConfig `yaml:"toolkits"`
}

LoaderConfig holds configuration for loading toolkits.

type Registry

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

Registry manages toolkit registration and lifecycle.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new toolkit registry.

func (*Registry) All

func (r *Registry) All() []Toolkit

All returns all registered toolkits.

func (*Registry) AllTools

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

AllTools returns all tool names from all toolkits.

func (*Registry) Close

func (r *Registry) Close() error

Close closes all registered toolkits.

func (*Registry) CreateAndRegister

func (r *Registry) CreateAndRegister(cfg ToolkitConfig) error

CreateAndRegister creates a toolkit from config and registers it.

func (*Registry) Get

func (r *Registry) Get(kind, name string) (Toolkit, bool)

Get retrieves a toolkit by kind and name.

func (*Registry) GetByKind

func (r *Registry) GetByKind(kind string) []Toolkit

GetByKind retrieves all toolkits of a kind.

func (*Registry) Register

func (r *Registry) Register(toolkit Toolkit) error

Register adds a toolkit to the registry.

func (*Registry) RegisterAllTools

func (r *Registry) RegisterAllTools(s *mcp.Server)

RegisterAllTools registers all tools from all toolkits with the MCP server.

func (*Registry) RegisterFactory

func (r *Registry) RegisterFactory(kind string, factory ToolkitFactory)

RegisterFactory registers a toolkit factory for a kind.

func (*Registry) SetQueryProvider

func (r *Registry) SetQueryProvider(provider query.Provider)

SetQueryProvider sets the query provider for all toolkits.

func (*Registry) SetSemanticProvider

func (r *Registry) SetSemanticProvider(provider semantic.Provider)

SetSemanticProvider sets the semantic provider for all toolkits.

type Toolkit

type Toolkit interface {
	// Kind returns the toolkit type (e.g., "trino", "datahub", "s3").
	Kind() string

	// Name returns the instance name from config.
	Name() string

	// RegisterTools registers all tools with the MCP server.
	RegisterTools(s *mcp.Server)

	// Tools returns a list of tool names provided by this toolkit.
	Tools() []string

	// SetSemanticProvider sets the semantic metadata provider for enrichment.
	SetSemanticProvider(provider semantic.Provider)

	// SetQueryProvider sets the query execution provider for enrichment.
	SetQueryProvider(provider query.Provider)

	// Close releases resources.
	Close() error
}

Toolkit is the interface that all composable toolkits must implement.

func DataHubFactory

func DataHubFactory(name string, cfg map[string]any) (Toolkit, error)

DataHubFactory creates a DataHub toolkit from configuration.

func S3Factory

func S3Factory(name string, cfg map[string]any) (Toolkit, error)

S3Factory creates an S3 toolkit from configuration.

func TrinoFactory

func TrinoFactory(name string, cfg map[string]any) (Toolkit, error)

TrinoFactory creates a Trino toolkit from configuration.

type ToolkitConfig

type ToolkitConfig struct {
	Kind    string
	Name    string
	Enabled bool
	Config  map[string]interface{}
	Default bool
}

ToolkitConfig holds configuration for a toolkit instance.

type ToolkitFactory

type ToolkitFactory func(name string, config map[string]interface{}) (Toolkit, error)

ToolkitFactory creates a toolkit from configuration.

type ToolkitKindConfig

type ToolkitKindConfig struct {
	Enabled   bool                      `yaml:"enabled"`
	Instances map[string]map[string]any `yaml:"instances"`
	Default   string                    `yaml:"default"`
	Config    map[string]any            `yaml:"config"`
}

ToolkitKindConfig holds configuration for a toolkit kind.

Jump to

Keyboard shortcuts

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