Documentation
¶
Overview ¶
Package actioncatalog provides the canonical GitLab action catalog shared by catalog-backed MCP tool surfaces.
The catalog is the intermediate action core between typed GitLab handlers and the public meta and dynamic tool surfaces. It stores executable actions as deterministic groups, preserving route metadata such as input schemas, output schemas, destructive flags, action aliases, tags, icons, descriptions, and formatter hooks.
Action IDs use the stable domain.action form derived from the backing meta-tool name and action name. For example, gitlab_project/create becomes project.create, and gitlab_merge_request/list becomes merge_request.list. Dynamic mode uses these IDs directly, while meta-tools expose the same routes through action dispatch inside domain tools.
This package is not the registry for individual MCP tools. Individual tools are still registered directly by internal/tools.RegisterAll for compatibility. Meta-tools and dynamic tools consume this catalog through adapters such as internal/tools.RegisterMetaCatalog and internal/tools/dynamic.NewRegistryFromCatalog.
Invariants ¶
Catalog construction must be deterministic. Groups preserve explicit action order for user-facing descriptions, cloning avoids mutable alias/schema sharing between surfaces, and validation rejects duplicate action IDs or ambiguous aliases before tools are registered.
Index ¶
- func DomainFromToolName(toolName string) string
- func ToActionMaps(catalog *Catalog) map[string]toolutil.ActionMap
- type Action
- type ActionID
- type Catalog
- func (c *Catalog) Action(id ActionID) (Action, bool)
- func (c *Catalog) ActionMaps() map[string]toolutil.ActionMap
- func (c *Catalog) Actions() []Action
- func (c *Catalog) AddAction(toolName string, action Action, groupOptions ...GroupOptions) error
- func (c *Catalog) AddGroup(group Group) error
- func (c *Catalog) Clone() *Catalog
- func (c *Catalog) CountActions() int
- func (c *Catalog) CountGroups() int
- func (c *Catalog) Filter(opts FilterOptions) *Catalog
- func (c *Catalog) FilterAllowedToolNames(toolNames []string) *Catalog
- func (c *Catalog) FilterExcludedTools(excludeTools []string) *Catalog
- func (c *Catalog) FilterReadOnlyGroups() *Catalog
- func (c *Catalog) Group(toolName string) (Group, bool)
- func (c *Catalog) Groups() []Group
- func (c *Catalog) Validate() error
- type CatalogGroupSpec
- type FilterOptions
- type Group
- type GroupOptions
- type SurfaceKind
- type SurfaceToolSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DomainFromToolName ¶
DomainFromToolName returns the canonical dynamic domain for a meta-tool name.
Types ¶
type Action ¶
type Action struct {
ID ActionID
ToolName string
Domain string
Name string
Route toolutil.ActionRoute
SchemaURI string
Aliases []string
Tags []string
Usage string
RelatedActions []string
Compatibility toolutil.CompatibilityPolicy
ReadOnly bool
Edition string
GitLabDotComOnly bool
OwnerPackage string
IndividualTool toolutil.IndividualToolSpec
ContentKind string
NotFoundPolicy string
EmbeddedResourcePolicy string
RichResultPolicy string
SchemaValidationNotes []string
RuntimeValidationNotes []string
SpecBacked bool
Destructive bool
Idempotent bool
OpenWorld bool
}
Action describes one executable GitLab action in the canonical catalog.
func ActionsFromSpecs ¶
func ActionsFromSpecs(specs []toolutil.ActionSpec) ([]Action, error)
ActionsFromSpecs projects canonical action specs into catalog actions.
type ActionID ¶
type ActionID string
ActionID is the stable dynamic identifier for one GitLab action.
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog stores deterministic groups and action lookup indexes. A Catalog is intended to be mutated during single-threaded initialization and then shared read-only; concurrent mutation is not supported.
func FromActionMaps ¶
FromActionMaps converts legacy route maps into a canonical catalog.
func FromActionMapsWithError ¶
FromActionMapsWithError converts legacy route maps into a canonical catalog and reports invalid groups instead of panicking.
func (*Catalog) ActionMaps ¶
ActionMaps returns a defensive legacy route snapshot keyed by tool and action.
func (*Catalog) AddAction ¶
func (c *Catalog) AddAction(toolName string, action Action, groupOptions ...GroupOptions) error
AddAction adds one action to an existing or newly-created group. When the group does not exist, callers may provide GroupOptions so the synthesized group carries the same metadata as a normal catalog group.
func (*Catalog) CountActions ¶
CountActions returns the number of actions in the catalog.
func (*Catalog) CountGroups ¶
CountGroups returns the number of groups in the catalog.
func (*Catalog) Filter ¶
func (c *Catalog) Filter(opts FilterOptions) *Catalog
Filter applies all catalog-level filters in a deterministic order.
func (*Catalog) FilterAllowedToolNames ¶
FilterAllowedToolNames returns a cloned catalog with only explicitly allowed tools.
func (*Catalog) FilterExcludedTools ¶
FilterExcludedTools returns a cloned catalog without excluded tool groups.
func (*Catalog) FilterReadOnlyGroups ¶
FilterReadOnlyGroups returns a cloned catalog containing only read-only groups.
type CatalogGroupSpec ¶
type CatalogGroupSpec struct {
ToolName string
Title string
Description string
ReadOnly bool
Icons []mcp.Icon
BaseDomain string
EnterpriseOnly bool
GitLabDotComOnly bool
CapabilityRequirements []string
FormatResult toolutil.FormatResultFunc
Actions []toolutil.ActionSpec
OwnerPackage string
SurfaceKind SurfaceKind
}
CatalogGroupSpec is the canonical metadata contract for one catalog group.
func CloneCatalogGroupSpec ¶
func CloneCatalogGroupSpec(spec CatalogGroupSpec) CatalogGroupSpec
CloneCatalogGroupSpec returns a defensive copy of group metadata.
func (CatalogGroupSpec) GroupOptions ¶
func (spec CatalogGroupSpec) GroupOptions() GroupOptions
GroupOptions returns catalog group options projected from the group spec.
func (CatalogGroupSpec) Validate ¶
func (spec CatalogGroupSpec) Validate() error
Validate verifies group-level catalog invariants before runtime projection.
type FilterOptions ¶
FilterOptions describes catalog-level filtering inputs.
type Group ¶
type Group struct {
ToolName string
Title string
Description string
Icons []mcp.Icon
ReadOnly bool
FormatResult toolutil.FormatResultFunc
BaseDomain string
EnterpriseOnly bool
GitLabDotComOnly bool
CapabilityRequirements []string
OwnerPackage string
SurfaceKind SurfaceKind
Actions map[string]Action
ActionOrder []string
}
Group describes all actions exposed through one logical meta-tool group.
func GroupFromSpecs ¶
func GroupFromSpecs(opts GroupOptions, specs []toolutil.ActionSpec) (Group, error)
GroupFromSpecs builds a catalog group from canonical action specs.
func NewGroup ¶
func NewGroup(opts GroupOptions) Group
NewGroup creates an action group with initialized maps.
func (*Group) ActionsInOrder ¶
ActionsInOrder returns group actions in deterministic action-name order.
type GroupOptions ¶
type GroupOptions struct {
ToolName string
Title string
Description string
Icons []mcp.Icon
ReadOnly bool
FormatResult toolutil.FormatResultFunc
BaseDomain string
EnterpriseOnly bool
GitLabDotComOnly bool
CapabilityRequirements []string
OwnerPackage string
SurfaceKind SurfaceKind
}
GroupOptions contains metadata for creating a catalog group.
type SurfaceKind ¶
type SurfaceKind string
SurfaceKind classifies the runtime surface represented by a catalog group.
const ( // SurfaceKindGitLabAction identifies ordinary GitLab API actions. SurfaceKindGitLabAction SurfaceKind = "gitlab-action" // SurfaceKindMetaGroup identifies visible domain meta-tool dispatchers. SurfaceKindMetaGroup SurfaceKind = "meta-group" // SurfaceKindDynamicController identifies Dynamic controller tools. SurfaceKindDynamicController SurfaceKind = "dynamic-controller" // SurfaceKindRuntimeUtility identifies non-GitLab runtime helper tools. SurfaceKindRuntimeUtility SurfaceKind = "runtime-utility" // SurfaceKindInteractiveUtility identifies tools that require MCP elicitation. SurfaceKindInteractiveUtility SurfaceKind = "interactive-utility" // SurfaceKindSamplingUtility identifies tools that require MCP sampling. SurfaceKindSamplingUtility SurfaceKind = "sampling-utility" // SurfaceKindServerMaintenance identifies server maintenance tools. SurfaceKindServerMaintenance SurfaceKind = "server-maintenance" )
type SurfaceToolSpec ¶
type SurfaceToolSpec struct {
Name string
Title string
Description string
GroupToolName string
BaseDomain string
ActionName string
SurfaceKind SurfaceKind
Route toolutil.ActionRoute
Aliases []string
Tags []string
RelatedActions []string
Compatibility toolutil.CompatibilityPolicy
Icons []mcp.Icon
CapabilityRequirements []string
FormatResult toolutil.FormatResultFunc
SafeModePolicy string
ReadOnlyPolicy string
OwnerPackage string
ReadOnly bool
Destructive bool
Idempotent bool
OpenWorld bool
}
SurfaceToolSpec is the canonical metadata contract for visible MCP tools that are not ordinary GitLab API meta-tool groups.
func CloneSurfaceToolSpec ¶
func CloneSurfaceToolSpec(spec SurfaceToolSpec) SurfaceToolSpec
CloneSurfaceToolSpec returns a defensive copy of surface tool metadata.
func (SurfaceToolSpec) ActionSpec ¶
func (spec SurfaceToolSpec) ActionSpec() (toolutil.ActionSpec, error)
ActionSpec projects a surface tool spec into the shared ActionSpec model.
func (SurfaceToolSpec) Validate ¶
func (spec SurfaceToolSpec) Validate() error
Validate verifies that the surface spec has enough metadata for runtime registration and catalog projection.