toolcatalog

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package toolcatalog provides compiled-in metadata for tools and capability tags, and renders capability surface descriptions for model-facing context and the web dashboard.

Index

Constants

View Source
const (
	ToolSourceNative  = "native"
	ToolSourceMCP     = "mcp"
	ToolSourceOverlay = "overlay"
)

Tool source kinds used in CapabilityToolSource.Kind.

View Source
const (
	ToolStateExcluded = "excluded"
)

Tool state statuses used in CapabilityToolState.Status.

Variables

This section is empty.

Functions

func BuiltinTagSpecs

func BuiltinTagSpecs() map[string]BuiltinTagSpec

BuiltinTagSpecs returns a copy of the compiled-in tag catalog.

func HasBuiltinTag

func HasBuiltinTag(name string) bool

HasBuiltinTag reports whether the name is a compiled-in tag.

func RenderCapabilityActivationDescription

func RenderCapabilityActivationDescription(entries []CapabilitySurface) string

RenderCapabilityActivationDescription renders the activate_capability tool help text from the shared capability surface.

func RenderCapabilityManifestMarkdown

func RenderCapabilityManifestMarkdown(entries []CapabilitySurface) string

RenderCapabilityManifestMarkdown renders the model-facing capability menu as a heading plus a compact JSON payload.

func RenderLoadedCapabilitySummary

func RenderLoadedCapabilitySummary(entries []CapabilitySurface, activeTags map[string]bool) string

RenderLoadedCapabilitySummary renders the currently loaded capabilities for always-on prompt context.

Types

type BuiltinTagSpec

type BuiltinTagSpec struct {
	Description  string
	AlwaysActive bool
	Menu         bool
	Protected    bool
}

BuiltinTagSpec captures compiled-in metadata for a tag/toolset.

type BuiltinToolSpec

type BuiltinToolSpec struct {
	CanonicalID string
	Source      ToolSource
	Tags        []string
}

BuiltinToolSpec captures compiled-in metadata for a tool.

func LookupBuiltinToolSpec

func LookupBuiltinToolSpec(name string) (BuiltinToolSpec, bool)

LookupBuiltinToolSpec returns the compiled-in tool spec for a tool name.

type CapabilityActionTools

type CapabilityActionTools struct {
	Activate   string `json:"activate"`
	Deactivate string `json:"deactivate"`
	Reset      string `json:"reset,omitempty"`
	List       string `json:"list,omitempty"`
	Inspect    string `json:"inspect,omitempty"`
	Delegate   string `json:"delegate,omitempty"`
}

CapabilityActionTools lists the tool names the model should use for capability lifecycle actions (activate, deactivate, reset, list, inspect).

type CapabilityCatalogEntry

type CapabilityCatalogEntry struct {
	Tag           string                    `json:"tag"`
	Status        string                    `json:"status"`
	Description   string                    `json:"description"`
	Teaser        string                    `json:"teaser,omitempty"`
	NextTags      []string                  `json:"next_tags,omitempty"`
	ToolCount     int                       `json:"tool_count,omitempty"`
	Tools         []string                  `json:"tools,omitempty"`
	ToolEntries   []CapabilityToolEntry     `json:"tool_entries,omitempty"`
	ExcludedTools []CapabilityToolEntry     `json:"excluded_tools,omitempty"`
	AlwaysActive  bool                      `json:"always_active,omitempty"`
	Protected     bool                      `json:"protected,omitempty"`
	AdHoc         bool                      `json:"ad_hoc,omitempty"`
	Context       *CapabilityContextSummary `json:"context,omitempty"`
}

CapabilityCatalogEntry is the API/model-facing representation of one capability in the full catalog view, including status and tool list.

ToolEntries carries per-tool source attribution (native, mcp, or overlay) so consumers can render where each tool comes from. ExcludedTools surfaces tools the operator overlay removed from this tag, populated only when the caller opts in (e.g. /api/capabilities?include=excluded).

func RenderCapabilityCatalogEntry

func RenderCapabilityCatalogEntry(entry CapabilitySurface, opts CatalogViewOptions) CapabilityCatalogEntry

RenderCapabilityCatalogEntry projects a single resolved surface entry into the JSON-tagged CapabilityCatalogEntry. Used by single-tag endpoints such as /api/capabilities/:tag.

type CapabilityCatalogView

type CapabilityCatalogView struct {
	Kind            string                   `json:"kind"`
	ActivationTools CapabilityActionTools    `json:"activation_tools"`
	Capabilities    []CapabilityCatalogEntry `json:"capabilities"`
}

CapabilityCatalogView is the top-level JSON-serializable view of the full capability catalog including activation tool names.

func BuildCapabilityCatalogView

func BuildCapabilityCatalogView(entries []CapabilitySurface, opts CatalogViewOptions) CapabilityCatalogView

BuildCapabilityCatalogView assembles the full capability catalog view from resolved surface entries, ready for JSON serialization.

type CapabilityContextSummary

type CapabilityContextSummary struct {
	KBArticles int  `json:"kb_articles,omitempty"`
	Live       bool `json:"live,omitempty"`
}

CapabilityContextSummary describes the optional context payload associated with a capability entry (KB articles and live context).

type CapabilitySurface

type CapabilitySurface struct {
	Tag           string
	Description   string
	Teaser        string
	NextTags      []string
	Tools         []string
	ToolEntries   []CapabilityToolEntry
	ExcludedTools []CapabilityToolEntry
	AlwaysActive  bool
	Menu          bool
	Protected     bool
	Loaded        bool
	KBArticles    int
	LiveContext   bool
	AdHoc         bool
}

CapabilitySurface captures the resolved model-facing view of a capability/toolset. It is intentionally transport-agnostic so prompt renderers, tool help text, and future caching/freshness policies can all work from the same semantic shape.

Tools is the flat sorted list of active tool names — the canonical runtime membership consumed by tag filtering. ToolEntries carries the same active tools enriched with source attribution for views that need to explain where each tool came from. ExcludedTools surfaces tools the operator overlay removed from this tag, used by API consumers that opt into excluded entries.

func BuildCapabilitySurface

func BuildCapabilitySurface(tags map[string][]string, descriptions map[string]string, alwaysActive map[string]bool, protected map[string]bool) []CapabilitySurface

BuildCapabilitySurface builds a sorted capability surface from tag membership and descriptions.

func SortCapabilitySurface

func SortCapabilitySurface(entries []CapabilitySurface) []CapabilitySurface

SortCapabilitySurface returns a sorted copy of the capability surface.

type CapabilityToolEntry

type CapabilityToolEntry struct {
	Name   string               `json:"name"`
	Source CapabilityToolSource `json:"source"`
	State  *CapabilityToolState `json:"state,omitempty"`
}

CapabilityToolEntry is the rich per-tool view for a tag with full source attribution. Used by inspect_capability, the CLI, and the /api/capabilities endpoints.

type CapabilityToolSource

type CapabilityToolSource struct {
	Kind   string `json:"kind"`
	Origin string `json:"origin,omitempty"`
}

CapabilityToolSource identifies where a tool comes from in a resolved capability tag — native catalog, an MCP bridge, or the operator overlay. Origin carries the concrete locator (server name for MCP, config path like "capability_tags.<tag>.include" for overlay). Native tools leave Origin empty since their declaration is recoverable from the catalog metadata.

type CapabilityToolState

type CapabilityToolState struct {
	Status string `json:"status"`
	Reason string `json:"reason,omitempty"`
}

CapabilityToolState describes a non-active state for a tool. Active tools omit State entirely. Status grows over time as the catalog gains lifecycle states (excluded, deprecated, unhealthy, …); the struct shape lets new fields land without breaking the wire format.

type CatalogViewOptions

type CatalogViewOptions struct {
	// IncludeDelegate adds the thane_now delegation tool to the
	// activation tools block in the rendered view. Set false for
	// surfaces where delegation is not relevant.
	IncludeDelegate bool

	// IncludeExcluded surfaces operator-excluded tools per tag in
	// CapabilityCatalogEntry.ExcludedTools. Active tools are always
	// included regardless of this setting.
	IncludeExcluded bool
}

CatalogViewOptions controls what optional sections appear in a generated CapabilityCatalogView. Defaults are conservative: only active tool members are surfaced. Callers opt in to nuances such as excluded tools via this struct.

type LoadedCapabilityEntry

type LoadedCapabilityEntry struct {
	Tag          string                    `json:"tag"`
	Description  string                    `json:"description,omitempty"`
	ToolCount    int                       `json:"tool_count,omitempty"`
	AlwaysActive bool                      `json:"always_active,omitempty"`
	Protected    bool                      `json:"protected,omitempty"`
	AdHoc        bool                      `json:"ad_hoc,omitempty"`
	Context      *CapabilityContextSummary `json:"context,omitempty"`
}

LoadedCapabilityEntry is the API/model-facing representation of one currently loaded (active) capability in the session.

func BuildLoadedCapabilityEntries

func BuildLoadedCapabilityEntries(entries []CapabilitySurface, activeTags []string) []LoadedCapabilityEntry

BuildLoadedCapabilityEntries returns the loaded-capability entries for the given active tags, enriched with descriptions and context from the full surface.

type LoadedCapabilityView

type LoadedCapabilityView struct {
	Kind               string                  `json:"kind"`
	LoadedCapabilities []LoadedCapabilityEntry `json:"loaded_capabilities"`
}

LoadedCapabilityView is the JSON-serializable view of the currently loaded capabilities in a session.

func BuildLoadedCapabilityView

func BuildLoadedCapabilityView(entries []CapabilitySurface, activeTags []string, includeDelegate bool) LoadedCapabilityView

BuildLoadedCapabilityView assembles the loaded-capability JSON view for the given active tags.

type ToolSource

type ToolSource string

ToolSource identifies where a tool originates.

const (
	NativeToolSource ToolSource = "native"
	MCPToolSource    ToolSource = "mcp"
)

Jump to

Keyboard shortcuts

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