features

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package features implements MCP tools for GitLab instance feature flag toggles.

The package wraps the GitLab Features API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionSpecs

func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec

ActionSpecs returns canonical specs for instance feature flag tools.

func Delete

func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error

Delete removes a feature flag.

func FormatFeatureMarkdown

func FormatFeatureMarkdown(output SetOutput) *mcp.CallToolResult

FormatFeatureMarkdown formats a single feature as markdown.

func FormatListDefinitionsMarkdown

func FormatListDefinitionsMarkdown(output ListDefinitionsOutput) *mcp.CallToolResult

FormatListDefinitionsMarkdown formats a list of feature definitions as markdown.

func FormatListMarkdown

func FormatListMarkdown(output ListOutput) *mcp.CallToolResult

FormatListMarkdown formats a list of features as markdown.

func SetRoute

func SetRoute(client *gitlabclient.Client) toolutil.ActionRoute

SetRoute returns the meta-tool route for setting instance feature flags.

Types

type DefinitionItem

type DefinitionItem struct {
	Name            string `json:"name"`
	IntroducedByURL string `json:"introduced_by_url,omitempty"`
	RolloutIssueURL string `json:"rollout_issue_url,omitempty"`
	Milestone       string `json:"milestone,omitempty"`
	LogStateChanges bool   `json:"log_state_changes"`
	Type            string `json:"type,omitempty"`
	Group           string `json:"group,omitempty"`
	DefaultEnabled  bool   `json:"default_enabled"`
}

DefinitionItem represents a feature definition.

type DeleteInput

type DeleteInput struct {
	Name string `json:"name" jsonschema:"Feature flag name to delete,required"`
}

DeleteInput is the input for deleting a feature flag.

type FeatureItem

type FeatureItem struct {
	Name       string          `json:"name"`
	State      string          `json:"state"`
	Gates      []GateItem      `json:"gates,omitempty"`
	Definition *DefinitionItem `json:"definition,omitempty"`
}

FeatureItem represents a feature flag.

type GateItem

type GateItem struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

GateItem represents a gate on a feature flag.

type ListDefinitionsInput

type ListDefinitionsInput struct{}

ListDefinitionsInput is the input for listing feature definitions.

type ListDefinitionsOutput

type ListDefinitionsOutput struct {
	toolutil.HintableOutput
	Definitions []DefinitionItem `json:"definitions"`
}

ListDefinitionsOutput is the output for listing feature definitions.

func ListDefinitions

ListDefinitions retrieves all feature definitions.

type ListInput

type ListInput struct{}

ListInput is the input for listing features.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	Features []FeatureItem `json:"features"`
}

ListOutput is the output for listing features.

func List

func List(ctx context.Context, client *gitlabclient.Client, _ ListInput) (ListOutput, error)

List retrieves all feature flags.

type SetInput

type SetInput struct {
	Name         string `json:"name"          jsonschema:"Feature flag name,required"`
	Value        any    `json:"value"         jsonschema:"Value to set (true, false, integer percentage, or string),required"`
	Key          string `json:"key,omitempty"            jsonschema:"Gate key (percentage_of_actors or percentage_of_time)"`
	FeatureGroup string `json:"feature_group,omitempty"  jsonschema:"Feature group name"`
	User         string `json:"user,omitempty"           jsonschema:"GitLab username"`
	Group        string `json:"group,omitempty"          jsonschema:"GitLab group path"`
	Namespace    string `json:"namespace,omitempty"      jsonschema:"GitLab namespace path"`
	Project      string `json:"project,omitempty"        jsonschema:"GitLab project path (namespace/project)"`
	Repository   string `json:"repository,omitempty"     jsonschema:"GitLab repository path"`
	Force        bool   `json:"force,omitempty"          jsonschema:"Force the change even if the flag is read-only"`
}

SetInput is the input for setting a feature flag.

type SetOutput

type SetOutput struct {
	toolutil.HintableOutput
	Feature FeatureItem `json:"feature"`
}

SetOutput is the output for setting a feature flag.

func Set

func Set(ctx context.Context, client *gitlabclient.Client, input SetInput) (SetOutput, error)

Set creates or updates a feature flag. Uses a raw HTTP request to work around upstream client-go issue where SetFeatureFlagOptions fields lack omitempty, causing GitLab to reject the request with "mutually exclusive" errors for empty string fields.

Jump to

Keyboard shortcuts

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