registry

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2026 Teradata

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package registry provides tool indexing and search capabilities. It maintains an FTS5 index of all available tools (builtin, MCP, custom) and supports LLM-assisted search for high accuracy tool discovery.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuiltinIndexer

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

BuiltinIndexer indexes builtin tools from pkg/shuttle.

func NewBuiltinIndexer

func NewBuiltinIndexer(tracer observability.Tracer, tools ...shuttle.Tool) *BuiltinIndexer

NewBuiltinIndexer creates a new builtin tool indexer. If no tools provided, it will use builtin.All(nil) to get all builtin tools.

func (*BuiltinIndexer) Index

func (i *BuiltinIndexer) Index(ctx context.Context) ([]*loomv1.IndexedTool, error)

Index indexes all builtin tools.

func (*BuiltinIndexer) Name

func (i *BuiltinIndexer) Name() string

Name returns the indexer name.

func (*BuiltinIndexer) Source

func (i *BuiltinIndexer) Source() loomv1.ToolSource

Source returns the tool source type.

type Config

type Config struct {
	DBPath   string            // Path to SQLite database
	LLM      types.LLMProvider // LLM provider for search assistance
	Tracer   observability.Tracer
	Indexers []Indexer // Tool source indexers
}

Config holds registry configuration.

type CustomIndexer

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

CustomIndexer indexes custom tool definitions from YAML files.

func NewCustomIndexer

func NewCustomIndexer(configPath string, tracer observability.Tracer) *CustomIndexer

NewCustomIndexer creates a new custom tool indexer.

func (*CustomIndexer) Index

func (i *CustomIndexer) Index(ctx context.Context) ([]*loomv1.IndexedTool, error)

Index indexes custom tool definitions.

func (*CustomIndexer) Name

func (i *CustomIndexer) Name() string

Name returns the indexer name.

func (*CustomIndexer) Source

func (i *CustomIndexer) Source() loomv1.ToolSource

Source returns the tool source type.

type Indexer

type Indexer interface {
	// Name returns the indexer name for logging.
	Name() string

	// Source returns the tool source type.
	Source() loomv1.ToolSource

	// Index indexes all tools from this source.
	Index(ctx context.Context) ([]*loomv1.IndexedTool, error)
}

Indexer is an interface for tool source indexers.

type MCPIndexer

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

MCPIndexer indexes tools from MCP servers.

func NewMCPIndexer

func NewMCPIndexer(mgr *manager.Manager, tracer observability.Tracer) *MCPIndexer

NewMCPIndexer creates a new MCP tool indexer.

func (*MCPIndexer) Index

func (i *MCPIndexer) Index(ctx context.Context) ([]*loomv1.IndexedTool, error)

Index indexes tools from all connected MCP servers.

func (*MCPIndexer) Name

func (i *MCPIndexer) Name() string

Name returns the indexer name.

func (*MCPIndexer) Source

func (i *MCPIndexer) Source() loomv1.ToolSource

Source returns the tool source type.

type Registry

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

Registry manages the tool index and provides search capabilities.

func New

func New(cfg Config) (*Registry, error)

New creates a new tool registry.

func (*Registry) Close

func (r *Registry) Close() error

Close closes the registry and its database connection.

func (*Registry) GetTool

func (r *Registry) GetTool(ctx context.Context, toolID string) (*loomv1.IndexedTool, error)

GetTool retrieves a specific tool by ID.

func (*Registry) GetToolsByCapability

func (r *Registry) GetToolsByCapability(ctx context.Context, capability string, sourceFilters []loomv1.ToolSource, maxResults int) ([]*loomv1.IndexedTool, error)

GetToolsByCapability returns tools with a specific capability tag.

func (*Registry) IndexAll

func (r *Registry) IndexAll(ctx context.Context) (*loomv1.IndexToolsResponse, error)

IndexAll indexes tools from all registered indexers.

func (*Registry) ListSources

func (r *Registry) ListSources(ctx context.Context) ([]*loomv1.ToolSourceInfo, error)

ListSources returns all registered tool sources.

func (*Registry) Search

Search performs LLM-assisted tool search.

type SearchTool

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

SearchTool is a builtin tool that enables agents to search for tools. It provides LLM-assisted tool discovery with high accuracy.

func NewSearchTool

func NewSearchTool(registry *Registry) *SearchTool

NewSearchTool creates a new tool search tool.

func (*SearchTool) Backend

func (t *SearchTool) Backend() string

Backend returns empty string as this tool is backend-agnostic.

func (*SearchTool) Description

func (t *SearchTool) Description() string

Description returns the tool description.

func (*SearchTool) Execute

func (t *SearchTool) Execute(ctx context.Context, params map[string]interface{}) (*shuttle.Result, error)

Execute searches for tools matching the query.

func (*SearchTool) InputSchema

func (t *SearchTool) InputSchema() *shuttle.JSONSchema

InputSchema returns the JSON schema for tool parameters.

func (*SearchTool) Name

func (t *SearchTool) Name() string

Name returns the tool name.

Jump to

Keyboard shortcuts

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