grouplabels

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package grouplabels implements GitLab group label operations including list, get, create, update, delete, subscribe, and unsubscribe. It exposes typed input/output structs and handler functions registered as MCP tools.

markdown.go provides Markdown formatting functions for group label MCP tool output.

register.go wires grouplabels MCP tools to the MCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

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

Delete removes a label from a GitLab group.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) *mcp.CallToolResult

FormatListMarkdown renders a paginated list of group labels as an MCP Markdown result.

func FormatListMarkdownString

func FormatListMarkdownString(out ListOutput) string

FormatListMarkdownString renders a paginated list of group labels as a Markdown table string.

func FormatMarkdown

func FormatMarkdown(l Output) string

FormatMarkdown renders a single group label as a Markdown summary.

func RegisterMeta

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

RegisterMeta registers group label meta-tool on the MCP server.

func RegisterTools

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

RegisterTools registers group label tools on the MCP server.

func Unsubscribe

func Unsubscribe(ctx context.Context, client *gitlabclient.Client, input SubscribeInput) error

Unsubscribe removes the authenticated user's subscription from a group label.

Types

type CreateInput

type CreateInput struct {
	GroupID     toolutil.StringOrInt `json:"group_id"              jsonschema:"Group ID or URL-encoded path,required"`
	Name        string               `json:"name"                  jsonschema:"Label name,required"`
	Color       string               `json:"color"                 jsonschema:"Label color in hex format (e.g. #FF0000),required"`
	Description string               `json:"description,omitempty" jsonschema:"Label description"`
	Priority    int64                `json:"priority,omitempty"    jsonschema:"Label priority (lower is higher priority, 0 means no priority)"`
}

CreateInput defines parameters for creating a group label.

type DeleteInput

type DeleteInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	LabelID toolutil.StringOrInt `json:"label_id" jsonschema:"Label ID or name,required"`
}

DeleteInput defines parameters for deleting a group label.

type GetInput

type GetInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	LabelID toolutil.StringOrInt `json:"label_id" jsonschema:"Label ID or name,required"`
}

GetInput defines parameters for retrieving a single group label.

type ListInput

type ListInput struct {
	GroupID                 toolutil.StringOrInt `json:"group_id"                          jsonschema:"Group ID or URL-encoded path,required"`
	Search                  string               `json:"search,omitempty"                  jsonschema:"Filter labels by keyword search"`
	WithCounts              bool                 `json:"with_counts,omitempty"             jsonschema:"Include issue and merge request counts"`
	IncludeAncestorGroups   bool                 `json:"include_ancestor_groups,omitempty"  jsonschema:"Include labels from ancestor groups"`
	IncludeDescendantGroups bool                 `json:"include_descendant_groups,omitempty" jsonschema:"Include labels from descendant groups"`
	OnlyGroupLabels         bool                 `json:"only_group_labels,omitempty"       jsonschema:"Only return group-level labels (exclude project labels)"`
	toolutil.PaginationInput
}

ListInput defines parameters for listing labels in a GitLab group.

type ListOutput

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

ListOutput holds a paginated list of group labels.

func List

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

List retrieves a paginated list of labels for a GitLab group.

type Output

type Output struct {
	toolutil.HintableOutput
	ID                     int64  `json:"id"`
	Name                   string `json:"name"`
	Color                  string `json:"color"`
	TextColor              string `json:"text_color"`
	Description            string `json:"description"`
	OpenIssuesCount        int64  `json:"open_issues_count"`
	ClosedIssuesCount      int64  `json:"closed_issues_count"`
	OpenMergeRequestsCount int64  `json:"open_merge_requests_count"`
	Priority               int64  `json:"priority"`
	IsProjectLabel         bool   `json:"is_project_label"`
	Subscribed             bool   `json:"subscribed"`
}

Output represents a single group label.

func Create

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

Create creates a new label in a GitLab group.

func Get

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

Get retrieves a single group label by ID or name.

func Subscribe

func Subscribe(ctx context.Context, client *gitlabclient.Client, input SubscribeInput) (Output, error)

Subscribe subscribes the authenticated user to a group label.

func Update

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

Update modifies an existing group label. Only non-empty fields are applied.

type SubscribeInput

type SubscribeInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	LabelID toolutil.StringOrInt `json:"label_id" jsonschema:"Label ID or name,required"`
}

SubscribeInput defines parameters for subscribing/unsubscribing to a group label.

type UpdateInput

type UpdateInput struct {
	GroupID     toolutil.StringOrInt `json:"group_id"              jsonschema:"Group ID or URL-encoded path,required"`
	LabelID     toolutil.StringOrInt `json:"label_id"              jsonschema:"Label ID or name,required"`
	NewName     string               `json:"new_name,omitempty"    jsonschema:"New label name"`
	Color       string               `json:"color,omitempty"       jsonschema:"New label color in hex format"`
	Description string               `json:"description,omitempty" jsonschema:"New label description"`
	Priority    int64                `json:"priority,omitempty"    jsonschema:"New label priority (0 to remove)"`
}

UpdateInput defines parameters for updating a group label.

Jump to

Keyboard shortcuts

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