featureflags

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package featureflags provides MCP tool handlers for GitLab project feature flag operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteFeatureFlag

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

DeleteFeatureFlag deletes a feature flag.

func FormatFeatureFlagMarkdown

func FormatFeatureFlagMarkdown(out Output) string

FormatFeatureFlagMarkdown formats a single feature flag as markdown.

func FormatListFeatureFlagsMarkdown

func FormatListFeatureFlagsMarkdown(out ListOutput) string

FormatListFeatureFlagsMarkdown formats a list of feature flags as markdown.

func RegisterMeta

func RegisterMeta(server *mcp.Server, client *gitlabclient.Client)

RegisterMeta registers the feature flag meta-tool.

func RegisterTools

func RegisterTools(server *mcp.Server, client *gitlabclient.Client)

RegisterTools registers all project feature flag individual tools.

Types

type CreateInput

type CreateInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Name        string               `json:"name" jsonschema:"Feature flag name,required"`
	Description string               `json:"description,omitempty" jsonschema:"Feature flag description"`
	Version     string               `json:"version,omitempty" jsonschema:"Version of the feature flag (new_version_flag)"`
	Active      *bool                `json:"active,omitempty" jsonschema:"Whether the flag is active"`
	Strategies  string               `json:"strategies,omitempty" jsonschema:"JSON array of strategy objects: [{name, parameters, scopes}]"`
}

CreateInput contains parameters for creating a feature flag.

type DeleteInput

type DeleteInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Name      string               `json:"name" jsonschema:"Feature flag name,required"`
}

DeleteInput contains parameters for deleting a feature flag.

type GetInput

type GetInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Name      string               `json:"name" jsonschema:"Feature flag name,required"`
}

GetInput contains parameters for getting a feature flag.

type ListInput

type ListInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Scope     string               `json:"scope,omitempty" jsonschema:"Filter by scope (enabled or disabled)"`
	toolutil.PaginationInput
}

ListInput contains parameters for listing feature flags.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	FeatureFlags []Output                  `json:"feature_flags"`
	Pagination   toolutil.PaginationOutput `json:"pagination"`
}

ListOutput represents a paginated list of feature flags.

func ListFeatureFlags

func ListFeatureFlags(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)

ListFeatureFlags lists feature flags for a project.

type Output

type Output struct {
	toolutil.HintableOutput
	Name        string           `json:"name"`
	Description string           `json:"description"`
	Active      bool             `json:"active"`
	Version     string           `json:"version"`
	CreatedAt   string           `json:"created_at,omitempty"`
	UpdatedAt   string           `json:"updated_at,omitempty"`
	Strategies  []StrategyOutput `json:"strategies,omitempty"`
}

Output represents a single project feature flag.

func CreateFeatureFlag

func CreateFeatureFlag(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)

CreateFeatureFlag creates a new feature flag.

func GetFeatureFlag

func GetFeatureFlag(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)

GetFeatureFlag gets a single feature flag by name.

func UpdateFeatureFlag

func UpdateFeatureFlag(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)

UpdateFeatureFlag updates an existing feature flag.

type ScopeInput

type ScopeInput struct {
	EnvironmentScope string `json:"environment_scope"`
}

ScopeInput represents a scope for strategy options.

type ScopeOutput

type ScopeOutput struct {
	ID               int64  `json:"id"`
	EnvironmentScope string `json:"environment_scope"`
}

ScopeOutput represents a feature flag scope.

type StrategyInput

type StrategyInput struct {
	ID         int64                   `json:"id,omitempty"`
	Name       string                  `json:"name"`
	Parameters *StrategyParameterInput `json:"parameters,omitempty"`
	Scopes     []ScopeInput            `json:"scopes,omitempty"`
}

StrategyInput represents a strategy for create/update operations.

type StrategyOutput

type StrategyOutput struct {
	ID         int64                    `json:"id"`
	Name       string                   `json:"name"`
	Parameters *StrategyParameterOutput `json:"parameters,omitempty"`
	Scopes     []ScopeOutput            `json:"scopes,omitempty"`
}

StrategyOutput represents a feature flag strategy.

type StrategyParameterInput

type StrategyParameterInput struct {
	GroupID    string `json:"group_id,omitempty"`
	UserIDs    string `json:"user_ids,omitempty"`
	Percentage string `json:"percentage,omitempty"`
	Rollout    string `json:"rollout,omitempty"`
	Stickiness string `json:"stickiness,omitempty"`
}

StrategyParameterInput represents strategy parameters for create/update.

type StrategyParameterOutput

type StrategyParameterOutput struct {
	GroupID    string `json:"group_id,omitempty"`
	UserIDs    string `json:"user_ids,omitempty"`
	Percentage string `json:"percentage,omitempty"`
	Rollout    string `json:"rollout,omitempty"`
	Stickiness string `json:"stickiness,omitempty"`
}

StrategyParameterOutput represents strategy parameters.

type UpdateInput

type UpdateInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Name        string               `json:"name" jsonschema:"Current feature flag name,required"`
	NewName     string               `json:"new_name,omitempty" jsonschema:"New feature flag name"`
	Description string               `json:"description,omitempty" jsonschema:"Feature flag description"`
	Active      *bool                `json:"active,omitempty" jsonschema:"Whether the flag is active"`
	Strategies  string               `json:"strategies,omitempty" jsonschema:"JSON array of strategy objects: [{id, name, parameters, scopes}]"`
}

UpdateInput contains parameters for updating a feature flag.

Jump to

Keyboard shortcuts

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