Documentation
¶
Index ¶
- func BuildDispatcher(catalog *Catalog, index *SearchIndex) []*agent.Tool
- type Catalog
- func (c *Catalog) DeferredToolCount() int
- func (c *Catalog) EnabledCategorySummary() map[string][]string
- func (c *Catalog) Get(name string) (ToolEntry, bool)
- func (c *Catalog) GetToolSafetyLevel(name string) (agent.SafetyLevel, bool)
- func (c *Catalog) ListCategories() []Category
- func (c *Catalog) ListTools(category string) []ToolSchema
- func (c *Catalog) ListVisibleTools(category string) []ToolSchema
- func (c *Catalog) Register(category string, tools []*agent.Tool)
- func (c *Catalog) RegisterCategory(cat Category)
- func (c *Catalog) SearchableEntries() []ToolEntry
- func (c *Catalog) ToolCount() int
- func (c *Catalog) ToolNamesForCategory(category string) []string
- type Category
- type SearchIndex
- type SearchResult
- type ToolEntry
- type ToolSchema
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 (*Catalog) DeferredToolCount ¶ added in v0.7.0
DeferredToolCount returns the number of tools with ExposureDeferred.
func (*Catalog) EnabledCategorySummary ¶ added in v0.6.0
EnabledCategorySummary returns a map of enabled category name → tool name list.
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 ¶
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 ¶
Register adds tools under the given category. The category must already be registered via RegisterCategory.
func (*Catalog) RegisterCategory ¶
RegisterCategory adds a category descriptor.
func (*Catalog) SearchableEntries ¶ added in v0.7.0
SearchableEntries returns all entries except those with ExposureHidden. The returned entries are ordered by insertion order.
func (*Catalog) ToolNamesForCategory ¶ added in v0.6.0
ToolNamesForCategory returns tool names registered under the given category.
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 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).