Documentation
¶
Overview ¶
Package labels implements MCP tools for GitLab project label operations.
The package wraps the GitLab Labels API:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
- func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
- func FormatListMarkdownString(out ListOutput) string
- func FormatMarkdown(l Output) string
- func Promote(ctx context.Context, client *gitlabclient.Client, input PromoteInput) error
- func Unsubscribe(ctx context.Context, client *gitlabclient.Client, input SubscribeInput) error
- type CreateInput
- type DeleteInput
- type GetInput
- type ListInput
- type ListOutput
- type Output
- func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)
- func Get(ctx context.Context, client *gitlabclient.Client, input GetInput) (Output, error)
- func Subscribe(ctx context.Context, client *gitlabclient.Client, input SubscribeInput) (Output, error)
- func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)
- type PromoteInput
- type SubscribeInput
- type UpdateInput
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 project label actions exposed as MCP tools. The list, get, create, update, delete, subscribe, unsubscribe, and promote routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).
func Delete ¶
func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
Delete removes a label from a GitLab project via the GitLab Labels API (DELETE /projects/:id/labels/:label_id). Requires Maintainer or Owner role; group-inherited labels must be deleted at the group level.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
FormatListMarkdown renders a paginated list of labels as an MCP Markdown result.
func FormatListMarkdownString ¶
func FormatListMarkdownString(out ListOutput) string
FormatListMarkdownString renders a paginated list of labels as a Markdown table string.
func FormatMarkdown ¶
FormatMarkdown renders a single label as a Markdown summary.
func Promote ¶
func Promote(ctx context.Context, client *gitlabclient.Client, input PromoteInput) error
Promote promotes a project label to a group label via the GitLab Labels promote API (POST /projects/:id/labels/:label_id/promote). Requires the project to belong to a group; cannot promote labels in personal (user-namespace) projects.
func Unsubscribe ¶
func Unsubscribe(ctx context.Context, client *gitlabclient.Client, input SubscribeInput) error
Unsubscribe removes the authenticated user's subscription from a project label via the GitLab Labels unsubscribe API (POST /projects/:id/labels/:label_id/unsubscribe). Returns 304 Not Modified when the user is not currently subscribed.
Types ¶
type CreateInput ¶
type CreateInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project 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)"`
Archived *bool `json:"archived,omitempty" jsonschema:"Whether to create the label in archived state"`
}
CreateInput defines parameters for creating a label.
type DeleteInput ¶
type DeleteInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
LabelID toolutil.StringOrInt `json:"label_id" jsonschema:"Label ID or name,required"`
Name string `json:"name,omitempty" jsonschema:"Label name to delete (alternative to label_id for selecting the label by name)"`
}
DeleteInput defines parameters for deleting a label.
type GetInput ¶
type GetInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project 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 label.
type ListInput ¶
type ListInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project 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"`
OrderBy string `json:"order_by,omitempty" jsonschema:"Column to order results by (e.g. name, created_at, updated_at)"`
Sort string `json:"sort,omitempty" jsonschema:"Sort direction (asc, desc)"`
toolutil.PaginationInput
toolutil.KeysetPaginationInput
}
ListInput defines parameters for listing labels in a GitLab project.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
Labels []Output `json:"labels"`
Pagination toolutil.PaginationOutput `json:"pagination"`
}
ListOutput holds a paginated list of labels.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List retrieves a paginated list of project labels via the GitLab Labels API (GET /projects/:id/labels). Supports filtering by search keyword, including ancestor group labels, and including issue/MR counts.
type Output ¶
Output represents a single project label.
func Create ¶
func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (Output, error)
Create creates a new label in a GitLab project via the GitLab Labels API (POST /projects/:id/labels). The Color must be a 6-digit hex value; existing label names return 409 Conflict.
func Get ¶
Get retrieves a single project label by its ID or name via the GitLab Labels API (GET /projects/:id/labels/:label_id).
func Subscribe ¶
func Subscribe(ctx context.Context, client *gitlabclient.Client, input SubscribeInput) (Output, error)
Subscribe subscribes the authenticated user to a label to receive notifications via the GitLab Labels subscribe API (POST /projects/:id/labels/:label_id/subscribe). Returns 304 Not Modified when the user is already subscribed.
func Update ¶
func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (Output, error)
Update modifies an existing project label via the GitLab Labels API (PUT /projects/:id/labels/:label_id). Only non-empty fields in the input are applied; new_name must be unique within the project.
type PromoteInput ¶
type PromoteInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
LabelID toolutil.StringOrInt `json:"label_id" jsonschema:"Label ID or name,required"`
}
PromoteInput defines parameters for promoting a project label to a group label.
type SubscribeInput ¶
type SubscribeInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project 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 label.
type UpdateInput ¶
type UpdateInput struct {
ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
LabelID toolutil.StringOrInt `json:"label_id" jsonschema:"Label ID or name,required"`
Name string `json:"name,omitempty" jsonschema:"Label name to update (alternative to label_id for selecting the label by name)"`
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)"`
Archived *bool `json:"archived,omitempty" jsonschema:"Set true to archive, false to unarchive"`
}
UpdateInput defines parameters for updating a label.