Documentation
¶
Overview ¶
Package registry provides toolkit registration and management.
Index ¶
- func RegisterBuiltinFactories(r *Registry)
- type AggregateToolkitFactory
- type ConnectionResolver
- type Loader
- type LoaderConfig
- type PromptArgumentInfo
- type PromptDescriber
- type PromptInfo
- type Registry
- func (r *Registry) All() []Toolkit
- func (r *Registry) AllTools() []string
- func (r *Registry) Close() error
- func (r *Registry) CreateAndRegister(cfg ToolkitConfig) error
- func (r *Registry) Get(kind, name string) (Toolkit, bool)
- func (r *Registry) GetAggregateFactory(kind string) (AggregateToolkitFactory, bool)
- func (r *Registry) GetByKind(kind string) []Toolkit
- func (r *Registry) GetToolkitForTool(toolName string) ToolkitMatch
- func (r *Registry) Register(toolkit Toolkit) error
- func (r *Registry) RegisterAggregateFactory(kind string, factory AggregateToolkitFactory)
- func (r *Registry) RegisterAllTools(s *mcp.Server)
- func (r *Registry) RegisterFactory(kind string, factory ToolkitFactory)
- func (r *Registry) SetQueryProvider(provider query.Provider)
- func (r *Registry) SetSemanticProvider(provider semantic.Provider)
- type Toolkit
- func DataHubFactory(name string, cfg map[string]any) (Toolkit, error)
- func GatewayAggregateFactory(defaultName string, instances map[string]map[string]any) (Toolkit, error)
- func S3Factory(name string, cfg map[string]any) (Toolkit, error)
- func TrinoAggregateFactory(defaultName string, instances map[string]map[string]any) (Toolkit, error)
- func TrinoFactory(name string, cfg map[string]any) (Toolkit, error)
- type ToolkitConfig
- type ToolkitFactory
- type ToolkitKindConfig
- type ToolkitMatch
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 AggregateToolkitFactory ¶ added in v0.26.0
type AggregateToolkitFactory func(defaultName string, instances map[string]map[string]any) (Toolkit, error)
AggregateToolkitFactory creates a single toolkit from multiple instance configs. Used for toolkit kinds that support multi-connection routing internally (e.g., Trino with multiserver.Manager).
type ConnectionResolver ¶ added in v1.57.0
ConnectionResolver is an optional interface for toolkits that fan out across multiple upstream connections (e.g. the mcp gateway). When implemented, the registry calls ConnectionForTool to attribute each tool to its specific upstream connection in audit rows; an empty return falls back to the toolkit's default Connection().
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads toolkits from configuration.
func (*Loader) Load ¶
func (l *Loader) Load(cfg LoaderConfig) error
Load loads toolkits from configuration.
type LoaderConfig ¶
type LoaderConfig struct {
Toolkits map[string]ToolkitKindConfig `yaml:"toolkits"`
}
LoaderConfig holds configuration for loading toolkits.
type PromptArgumentInfo ¶ added in v1.38.0
type PromptArgumentInfo struct {
Name string `json:"name"`
Description string `json:"description"`
Required bool `json:"required"`
}
PromptArgumentInfo describes an argument for a registered MCP prompt.
type PromptDescriber ¶ added in v1.38.0
type PromptDescriber interface {
PromptInfos() []PromptInfo
}
PromptDescriber is an optional interface that toolkits can implement to advertise the prompts they register. This allows the platform to include toolkit-registered prompts in the platform_info response.
type PromptInfo ¶ added in v1.38.0
type PromptInfo struct {
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category,omitempty"`
Content string `json:"content,omitempty"`
Arguments []PromptArgumentInfo `json:"arguments,omitempty"`
}
PromptInfo describes a registered MCP prompt for metadata collection.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages toolkit registration and lifecycle.
func (*Registry) CreateAndRegister ¶
func (r *Registry) CreateAndRegister(cfg ToolkitConfig) error
CreateAndRegister creates a toolkit from config and registers it.
func (*Registry) GetAggregateFactory ¶ added in v0.26.0
func (r *Registry) GetAggregateFactory(kind string) (AggregateToolkitFactory, bool)
GetAggregateFactory returns the aggregate factory for a kind, if registered.
func (*Registry) GetToolkitForTool ¶ added in v0.12.1
func (r *Registry) GetToolkitForTool(toolName string) ToolkitMatch
GetToolkitForTool returns toolkit info (kind, name, connection) for a tool. Returns Found=false if the tool is not found in any registered toolkit.
func (*Registry) RegisterAggregateFactory ¶ added in v0.26.0
func (r *Registry) RegisterAggregateFactory(kind string, factory AggregateToolkitFactory)
RegisterAggregateFactory registers an aggregate toolkit factory for a kind. Aggregate factories receive all instance configs and produce a single toolkit that handles multi-connection routing internally.
func (*Registry) RegisterAllTools ¶
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 ¶
SetQueryProvider sets the query provider for all toolkits.
func (*Registry) SetSemanticProvider ¶
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
// Connection returns the connection name for audit logging.
// This identifies the specific backend connection (e.g., "prod-trino", "main-datahub").
Connection() 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 ¶
DataHubFactory creates a DataHub toolkit from configuration.
func GatewayAggregateFactory ¶ added in v1.57.0
func GatewayAggregateFactory(defaultName string, instances map[string]map[string]any) (Toolkit, error)
GatewayAggregateFactory creates a multi-connection gateway toolkit from all configured instances. Per-instance config parse errors fail the factory; upstream connectivity failures are absorbed and logged so an unreachable upstream cannot block platform startup.
func TrinoAggregateFactory ¶ added in v0.26.0
func TrinoAggregateFactory(defaultName string, instances map[string]map[string]any) (Toolkit, error)
TrinoAggregateFactory creates a single multi-connection Trino toolkit from all configured instances. This ensures deterministic connection routing based on the "connection" parameter in each tool call, rather than the non-deterministic last-write-wins behavior of N separate toolkits.
type ToolkitConfig ¶
type ToolkitConfig struct {
Kind string
Name string
Enabled bool
Config map[string]any
Default bool
}
ToolkitConfig holds configuration for a toolkit instance.
type ToolkitFactory ¶
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.
type ToolkitMatch ¶ added in v0.14.0
type ToolkitMatch struct {
Kind string
Name string
Connection string
Found bool
// ConnectionResolved is true when Connection was determined by the
// toolkit's ConnectionResolver (per-tool routing) rather than from
// the toolkit's default Connection(). When true, downstream
// middleware MUST NOT override Connection from request arguments —
// the toolkit owns the routing and a caller-supplied "connection"
// arg is either ignored by the toolkit or attempts to spoof audit.
ConnectionResolved bool
}
ToolkitMatch contains the result of matching a tool to its toolkit.