toolcatalog

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDispatcher

func BuildDispatcher(catalog *Catalog, index *SearchIndex) []*agent.Tool

BuildDispatcher returns meta-tools that provide dynamic access to the catalog: builtin_list (discovery), builtin_invoke (proxy execution), builtin_health (diagnostics), and builtin_search (keyword search).

Types

type Catalog

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

Catalog is a thread-safe registry of built-in tools grouped by category.

func New

func New() *Catalog

New creates an empty Catalog.

func (*Catalog) DeferredToolCount added in v0.7.0

func (c *Catalog) DeferredToolCount() int

DeferredToolCount returns the number of tools with ExposureDeferred.

func (*Catalog) EnabledCategorySummary added in v0.6.0

func (c *Catalog) EnabledCategorySummary() map[string][]string

EnabledCategorySummary returns a map of enabled category name → tool name list.

func (*Catalog) Get

func (c *Catalog) Get(name string) (ToolEntry, bool)

Get returns the entry for the named tool.

func (*Catalog) GetToolSafetyLevel added in v0.7.0

func (c *Catalog) GetToolSafetyLevel(name string) (agent.SafetyLevel, bool)

GetToolSafetyLevel returns the SafetyLevel for the named tool. Returns (level, true) if found, or (SafetyLevelDangerous, false) if not found (fail-safe).

func (*Catalog) ListCategories

func (c *Catalog) ListCategories() []Category

ListCategories returns all registered categories sorted by name.

func (*Catalog) ListTools

func (c *Catalog) ListTools(category string) []ToolSchema

ListTools returns schemas for all tools in the given category. If category is empty, all tools are returned.

func (*Catalog) ListVisibleTools added in v0.7.0

func (c *Catalog) ListVisibleTools(category string) []ToolSchema

ListVisibleTools returns schemas for tools whose Exposure is visible (Default or AlwaysVisible). If category is non-empty, results are further filtered by category.

func (*Catalog) Register

func (c *Catalog) Register(category string, tools []*agent.Tool)

Register adds tools under the given category. The category must already be registered via RegisterCategory.

func (*Catalog) RegisterCategory

func (c *Catalog) RegisterCategory(cat Category)

RegisterCategory adds a category descriptor.

func (*Catalog) SearchableEntries added in v0.7.0

func (c *Catalog) SearchableEntries() []ToolEntry

SearchableEntries returns all entries except those with ExposureHidden. The returned entries are ordered by insertion order.

func (*Catalog) ToolCount

func (c *Catalog) ToolCount() int

ToolCount returns the total number of registered tools.

func (*Catalog) ToolNamesForCategory added in v0.6.0

func (c *Catalog) ToolNamesForCategory(category string) []string

ToolNamesForCategory returns tool names registered under the given category.

type Category

type Category struct {
	Name        string
	Description string
	ConfigKey   string
	Enabled     bool
}

Category describes a group of related tools.

type SearchIndex added in v0.7.0

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

SearchIndex provides weighted keyword search over the tool catalog.

func NewSearchIndex added in v0.7.0

func NewSearchIndex(catalog *Catalog) *SearchIndex

NewSearchIndex builds a SearchIndex from the catalog's searchable entries.

func (*SearchIndex) Rebuild added in v0.7.0

func (idx *SearchIndex) Rebuild(catalog *Catalog)

Rebuild replaces the index contents from the catalog's current searchable entries.

func (*SearchIndex) Search added in v0.7.0

func (idx *SearchIndex) Search(query string, limit int) []SearchResult

Search returns tools matching the query, ranked by weighted scoring. Multi-token queries sum scores across all tokens. Results are sorted by score descending; ties broken by name ascending. A limit of 0 or negative returns all matches.

type SearchResult added in v0.7.0

type SearchResult struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Category    string  `json:"category"`
	Score       float64 `json:"score"`
	MatchField  string  `json:"match_field"`        // which field matched best
	Activity    string  `json:"activity,omitempty"` // activity kind (read, write, execute, etc.)
}

SearchResult holds a single search hit with its relevance score.

type ToolEntry

type ToolEntry struct {
	Tool     *agent.Tool
	Category string
}

ToolEntry pairs a tool with its category.

type ToolSchema

type ToolSchema struct {
	Name                 string   `json:"name"`
	Description          string   `json:"description"`
	Category             string   `json:"category"`
	SafetyLevel          string   `json:"safety_level"`
	Aliases              []string `json:"aliases,omitempty"`
	SearchHints          []string `json:"search_hints,omitempty"`
	Exposure             string   `json:"exposure,omitempty"`
	ReadOnly             bool     `json:"read_only,omitempty"`
	Activity             string   `json:"activity,omitempty"`
	RequiredCapabilities []string `json:"required_capabilities,omitempty"`
}

ToolSchema is a summary returned by ListTools (no handler exposed).

Jump to

Keyboard shortcuts

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