Documentation
¶
Overview ¶
Package store keeps the read-only built-in tool assets together with a writable overlay that enables or disables individual bundles or tools.
Index ¶
- func InitToolStoreHandlers(api huma.API, store *ToolStore)
- type BuiltInToolData
- func (d *BuiltInToolData) GetBuiltInTool(ctx context.Context, bundleID bundleitemutils.BundleID, ...) (spec.Tool, error)
- func (d *BuiltInToolData) GetBuiltInToolBundle(ctx context.Context, id bundleitemutils.BundleID) (spec.ToolBundle, error)
- func (d *BuiltInToolData) ListBuiltInToolData(ctx context.Context) (bundles map[bundleitemutils.BundleID]spec.ToolBundle, ...)
- func (d *BuiltInToolData) SetToolBundleEnabled(ctx context.Context, id bundleitemutils.BundleID, enabled bool) (spec.ToolBundle, error)
- func (d *BuiltInToolData) SetToolEnabled(ctx context.Context, bundleID bundleitemutils.BundleID, ...) (spec.Tool, error)
- type BuiltInToolDataOption
- type Option
- type ToolStore
- func (ts *ToolStore) Close()
- func (ts *ToolStore) DeleteTool(ctx context.Context, req *spec.DeleteToolRequest) (*spec.DeleteToolResponse, error)
- func (ts *ToolStore) DeleteToolBundle(ctx context.Context, req *spec.DeleteToolBundleRequest) (*spec.DeleteToolBundleResponse, error)
- func (ts *ToolStore) GetTool(ctx context.Context, req *spec.GetToolRequest) (*spec.GetToolResponse, error)
- func (ts *ToolStore) InvokeTool(ctx context.Context, req *spec.InvokeToolRequest) (*spec.InvokeToolResponse, error)
- func (ts *ToolStore) ListToolBundles(ctx context.Context, req *spec.ListToolBundlesRequest) (*spec.ListToolBundlesResponse, error)
- func (ts *ToolStore) ListTools(ctx context.Context, req *spec.ListToolsRequest) (*spec.ListToolsResponse, error)
- func (ts *ToolStore) PatchTool(ctx context.Context, req *spec.PatchToolRequest) (*spec.PatchToolResponse, error)
- func (ts *ToolStore) PatchToolBundle(ctx context.Context, req *spec.PatchToolBundleRequest) (*spec.PatchToolBundleResponse, error)
- func (ts *ToolStore) PutTool(ctx context.Context, req *spec.PutToolRequest) (*spec.PutToolResponse, error)
- func (ts *ToolStore) PutToolBundle(ctx context.Context, req *spec.PutToolBundleRequest) (*spec.PutToolBundleResponse, error)
- func (ts *ToolStore) SearchTools(ctx context.Context, req *spec.SearchToolsRequest) (*spec.SearchToolsResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitToolStoreHandlers ¶
InitToolStoreHandlers registers all endpoints for tool bundles and tools.
Types ¶
type BuiltInToolData ¶
type BuiltInToolData struct {
// contains filtered or unexported fields
}
func NewBuiltInToolData ¶
func NewBuiltInToolData( ctx context.Context, overlayBaseDir string, snapshotMaxAge time.Duration, opts ...BuiltInToolDataOption, ) (*BuiltInToolData, error)
func (*BuiltInToolData) GetBuiltInTool ¶
func (d *BuiltInToolData) GetBuiltInTool( ctx context.Context, bundleID bundleitemutils.BundleID, slug bundleitemutils.ItemSlug, version bundleitemutils.ItemVersion, ) (spec.Tool, error)
func (*BuiltInToolData) GetBuiltInToolBundle ¶
func (d *BuiltInToolData) GetBuiltInToolBundle( ctx context.Context, id bundleitemutils.BundleID, ) (spec.ToolBundle, error)
func (*BuiltInToolData) ListBuiltInToolData ¶
func (d *BuiltInToolData) ListBuiltInToolData(ctx context.Context) ( bundles map[bundleitemutils.BundleID]spec.ToolBundle, tools map[bundleitemutils.BundleID]map[bundleitemutils.ItemID]spec.Tool, err error, )
func (*BuiltInToolData) SetToolBundleEnabled ¶
func (d *BuiltInToolData) SetToolBundleEnabled( ctx context.Context, id bundleitemutils.BundleID, enabled bool, ) (spec.ToolBundle, error)
SetToolBundleEnabled toggles a bundle flag and returns the updated bundle.
func (*BuiltInToolData) SetToolEnabled ¶
func (d *BuiltInToolData) SetToolEnabled( ctx context.Context, bundleID bundleitemutils.BundleID, slug bundleitemutils.ItemSlug, version bundleitemutils.ItemVersion, enabled bool, ) (spec.Tool, error)
SetToolEnabled toggles one tool (identified by slug+version) and returns the updated object. Deriving the primary key from slug & version keeps the API parallel to the prompt store.
type BuiltInToolDataOption ¶
type BuiltInToolDataOption func(*BuiltInToolData)
func WithLLMToolsGoBuiltins ¶
func WithLLMToolsGoBuiltins(enabled bool) BuiltInToolDataOption
WithLLMToolsGoBuiltins enables importing Go builtin tool manifests from llmtools-go at runtime.
func WithToolBundlesFS ¶
func WithToolBundlesFS(fsys fs.FS, rootDir string) BuiltInToolDataOption
type ToolStore ¶
type ToolStore struct {
// contains filtered or unexported fields
}
ToolStore provides CRUD, soft-delete and optional FTS for Tool bundles.
func NewToolStore ¶
NewToolStore initialises a ToolStore rooted at baseDir.
func (*ToolStore) DeleteTool ¶
func (ts *ToolStore) DeleteTool( ctx context.Context, req *spec.DeleteToolRequest, ) (*spec.DeleteToolResponse, error)
DeleteTool removes a tool version permanently.
func (*ToolStore) DeleteToolBundle ¶
func (ts *ToolStore) DeleteToolBundle( ctx context.Context, req *spec.DeleteToolBundleRequest, ) (*spec.DeleteToolBundleResponse, error)
DeleteToolBundle performs soft delete (only if empty).
func (*ToolStore) GetTool ¶
func (ts *ToolStore) GetTool( ctx context.Context, req *spec.GetToolRequest, ) (*spec.GetToolResponse, error)
GetTool retrieves a specific tool version.
func (*ToolStore) InvokeTool ¶
func (ts *ToolStore) InvokeTool( ctx context.Context, req *spec.InvokeToolRequest, ) (*spec.InvokeToolResponse, error)
InvokeTool locates a tool version and executes it according to its type. - Validates struct (validateTool), bundle/tool enabled state. - Dispatches to HTTP or Go runner with functional options constructed from the request body.
func (*ToolStore) ListToolBundles ¶
func (ts *ToolStore) ListToolBundles( ctx context.Context, req *spec.ListToolBundlesRequest, ) (*spec.ListToolBundlesResponse, error)
ListToolBundles returns bundles with filtering & pagination.
func (*ToolStore) ListTools ¶
func (ts *ToolStore) ListTools( ctx context.Context, req *spec.ListToolsRequest, ) (*spec.ListToolsResponse, error)
ListTools enumerates every stored tool version subject to filters.
func (*ToolStore) PatchTool ¶
func (ts *ToolStore) PatchTool( ctx context.Context, req *spec.PatchToolRequest, ) (*spec.PatchToolResponse, error)
PatchTool toggles enabled flag on a tool version.
func (*ToolStore) PatchToolBundle ¶
func (ts *ToolStore) PatchToolBundle( ctx context.Context, req *spec.PatchToolBundleRequest, ) (*spec.PatchToolBundleResponse, error)
PatchToolBundle toggles the enabled flag.
func (*ToolStore) PutTool ¶
func (ts *ToolStore) PutTool( ctx context.Context, req *spec.PutToolRequest, ) (*spec.PutToolResponse, error)
PutTool creates a new tool version (immutable). Only HTTPImpl function tools are allowed to be added as of now.
func (*ToolStore) PutToolBundle ¶
func (ts *ToolStore) PutToolBundle( ctx context.Context, req *spec.PutToolBundleRequest, ) (*spec.PutToolBundleResponse, error)
PutToolBundle creates or replaces a bundle.
func (*ToolStore) SearchTools ¶
func (ts *ToolStore) SearchTools( ctx context.Context, req *spec.SearchToolsRequest, ) (*spec.SearchToolsResponse, error)
SearchTools executes a full-text query via FTS.