Documentation
¶
Index ¶
- type BleveIndex
- func (b *BleveIndex) BatchIndex(tools []*config.ToolMetadata) error
- func (b *BleveIndex) Close() error
- func (b *BleveIndex) DeleteAll() error
- func (b *BleveIndex) DeleteServerTools(serverName string) error
- func (b *BleveIndex) DeleteTool(serverName, toolName string) error
- func (b *BleveIndex) GetAllIndexedServerNames() ([]string, error)
- func (b *BleveIndex) GetDocumentCount() (uint64, error)
- func (b *BleveIndex) GetToolsByServer(serverName string) ([]*config.ToolMetadata, error)
- func (b *BleveIndex) IndexTool(toolMeta *config.ToolMetadata) error
- func (b *BleveIndex) RebuildIndex() error
- func (b *BleveIndex) SearchTools(queryStr string, limit int) ([]*config.SearchResult, error)
- type Manager
- func (m *Manager) BatchIndexTools(tools []*config.ToolMetadata) error
- func (m *Manager) ClearAll() error
- func (m *Manager) Close() error
- func (m *Manager) DeleteServerTools(serverName string) error
- func (m *Manager) DeleteTool(serverName, toolName string) error
- func (m *Manager) DropProfile(slug string) error
- func (m *Manager) ExistingProfileDirs() ([]string, error)
- func (m *Manager) ForProfile(slug string) (*Manager, error)
- func (m *Manager) GetAllIndexedServerNames() ([]string, error)
- func (m *Manager) GetDocumentCount() (uint64, error)
- func (m *Manager) GetStats() (map[string]interface{}, error)
- func (m *Manager) GetToolsByServer(serverName string) ([]*config.ToolMetadata, error)
- func (m *Manager) IndexTool(toolMeta *config.ToolMetadata) error
- func (m *Manager) ProfileSlugs() []string
- func (m *Manager) RebuildIndex() error
- func (m *Manager) RebuildProfileFromShared(slug string, servers []string) error
- func (m *Manager) Search(query string, limit int) ([]*config.SearchResult, error)
- func (m *Manager) SearchTools(query string, limit int) ([]*config.SearchResult, error)
- type ToolDocument
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BleveIndex ¶
type BleveIndex struct {
// contains filtered or unexported fields
}
BleveIndex wraps Bleve index operations
func NewBleveIndex ¶
func NewBleveIndex(dataDir string, logger *zap.Logger) (*BleveIndex, error)
NewBleveIndex creates (or opens) the shared default Bleve index at <dataDir>/index.bleve.
func (*BleveIndex) BatchIndex ¶
func (b *BleveIndex) BatchIndex(tools []*config.ToolMetadata) error
BatchIndex indexes multiple tools in a single batch
func (*BleveIndex) DeleteAll ¶ added in v0.46.0
func (b *BleveIndex) DeleteAll() error
DeleteAll removes every document from the index, leaving an empty index in place. Used to rebuild a per-profile index from scratch without recreating its on-disk directory.
func (*BleveIndex) DeleteServerTools ¶
func (b *BleveIndex) DeleteServerTools(serverName string) error
DeleteServerTools removes all tools from a specific server
func (*BleveIndex) DeleteTool ¶
func (b *BleveIndex) DeleteTool(serverName, toolName string) error
DeleteTool removes a tool from the index
func (*BleveIndex) GetAllIndexedServerNames ¶ added in v0.16.6
func (b *BleveIndex) GetAllIndexedServerNames() ([]string, error)
GetAllIndexedServerNames returns the unique set of server names present in the index.
func (*BleveIndex) GetDocumentCount ¶
func (b *BleveIndex) GetDocumentCount() (uint64, error)
GetDocumentCount returns the number of documents in the index
func (*BleveIndex) GetToolsByServer ¶
func (b *BleveIndex) GetToolsByServer(serverName string) ([]*config.ToolMetadata, error)
GetToolsByServer retrieves all tools from a specific server
func (*BleveIndex) IndexTool ¶
func (b *BleveIndex) IndexTool(toolMeta *config.ToolMetadata) error
IndexTool indexes a tool document
func (*BleveIndex) RebuildIndex ¶
func (b *BleveIndex) RebuildIndex() error
RebuildIndex rebuilds the entire index
func (*BleveIndex) SearchTools ¶
func (b *BleveIndex) SearchTools(queryStr string, limit int) ([]*config.SearchResult, error)
SearchTools searches for tools using multiple query strategies for better results
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides a unified interface for indexing operations.
A root Manager (created via NewManager) owns the shared default index at <dataDir>/index.bleve plus a lazily-populated map of per-profile sub-Managers (Profiles v2, Spec 057). Each sub-Manager, obtained via ForProfile, wraps its own index at <dataDir>/index.bleve/profiles/<slug>/ and reuses the full Manager method surface. Sub-Managers do not themselves nest further (their profiles map is nil), so ForProfile is only meaningful on the root.
func NewManager ¶
NewManager creates a new root index manager backed by the shared default index.
func (*Manager) BatchIndexTools ¶
func (m *Manager) BatchIndexTools(tools []*config.ToolMetadata) error
BatchIndexTools indexes multiple tools efficiently
func (*Manager) ClearAll ¶ added in v0.46.0
ClearAll removes every document from this index, leaving it empty.
func (*Manager) DeleteServerTools ¶
DeleteServerTools removes all tools from a specific server
func (*Manager) DeleteTool ¶
DeleteTool removes a tool from the index
func (*Manager) DropProfile ¶ added in v0.46.0
DropProfile closes the named profile's index (if open) and removes its on-disk directory. It is a no-op if the profile was never opened and its directory does not exist. The empty (default) slug cannot be dropped.
func (*Manager) ExistingProfileDirs ¶ added in v0.46.0
ExistingProfileDirs returns the slugs of every per-profile index directory present on disk under <dataDir>/index.bleve/profiles/, regardless of whether it is currently open. Only valid, filesystem-safe slug directories are returned. Used to reclaim orphaned profile indexes left by a prior run.
func (*Manager) ForProfile ¶ added in v0.46.0
ForProfile returns the index Manager scoped to the named profile, backed by a physically separate index at <dataDir>/index.bleve/profiles/<slug>/. The per-profile index is opened (or created) lazily on first use and cached, so repeated calls for the same slug return the same handle. An empty slug returns the root (shared default) Manager. The slug must be a valid, filesystem-safe profile slug (see config.IsValidProfileSlug) — invalid slugs are rejected to prevent path traversal. Only valid on a root Manager.
func (*Manager) GetAllIndexedServerNames ¶ added in v0.16.6
GetAllIndexedServerNames returns all unique server names in the index.
func (*Manager) GetDocumentCount ¶
GetDocumentCount returns the number of indexed documents
func (*Manager) GetToolsByServer ¶
func (m *Manager) GetToolsByServer(serverName string) ([]*config.ToolMetadata, error)
GetToolsByServer retrieves all tools from a specific server
func (*Manager) IndexTool ¶
func (m *Manager) IndexTool(toolMeta *config.ToolMetadata) error
IndexTool indexes a single tool
func (*Manager) ProfileSlugs ¶ added in v0.46.0
ProfileSlugs returns the slugs of all currently open per-profile indexes.
func (*Manager) RebuildIndex ¶
RebuildIndex rebuilds the entire index
func (*Manager) RebuildProfileFromShared ¶ added in v0.46.0
RebuildProfileFromShared (re)builds the named profile's index to contain exactly the tools of the given servers, sourced from the shared default index. The profile index is cleared first, so the operation is idempotent and only ever touches the named profile — other profiles are left untouched (reload isolation). Servers with no indexed tools contribute nothing; an empty server list yields an empty profile index.
func (*Manager) SearchTools ¶
SearchTools searches for tools matching the query
type ToolDocument ¶
type ToolDocument struct {
ToolName string `json:"tool_name"` // Just the tool name (without server prefix)
FullToolName string `json:"full_tool_name"` // Complete server:tool format
ServerName string `json:"server_name"`
Description string `json:"description"`
ParamsJSON string `json:"params_json"`
OutputSchemaJSON string `json:"output_schema_json,omitempty"`
Hash string `json:"hash"`
Tags string `json:"tags"`
SearchableText string `json:"searchable_text"` // Combined searchable content
}
ToolDocument represents a tool document in the index