Help us shape the future of Go! Take the 2026 Go Developer Survey

badges

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package badges implements MCP tools for GitLab project badge operations.

The package wraps the GitLab Project badges API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteGroup

func DeleteGroup(ctx context.Context, client *gitlabclient.Client, input DeleteGroupInput) error

DeleteGroup deletes a group badge.

func DeleteGroupOutput

func DeleteGroupOutput(ctx context.Context, client *gitlabclient.Client, input DeleteGroupInput) (toolutil.DeleteOutput, error)

DeleteGroupOutput deletes a group badge and returns the legacy success message shape.

func DeleteProject

func DeleteProject(ctx context.Context, client *gitlabclient.Client, input DeleteProjectInput) error

DeleteProject deletes a project badge.

func DeleteProjectOutput

func DeleteProjectOutput(ctx context.Context, client *gitlabclient.Client, input DeleteProjectInput) (toolutil.DeleteOutput, error)

DeleteProjectOutput deletes a project badge and returns the legacy success message shape.

func FormatBadgeListMarkdown

func FormatBadgeListMarkdown(badges []BadgeItem, title string, pagination toolutil.PaginationOutput) *mcp.CallToolResult

FormatBadgeListMarkdown formats a list of badges as a Markdown table: a collection of objects that share columns.

func FormatBadgeMarkdown

func FormatBadgeMarkdown(b BadgeItem) *mcp.CallToolResult

FormatBadgeMarkdown formats a single badge as the card of one object.

func GroupActionSpecs

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

GroupActionSpecs returns canonical specs for group badge actions.

func ProjectActionSpecs

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

ProjectActionSpecs returns canonical specs for project badge actions.

Types

type AddGroupInput

type AddGroupInput struct {
	GroupID  toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	LinkURL  string               `json:"link_url" jsonschema:"Badge link URL (supports placeholders),required"`
	ImageURL string               `json:"image_url" jsonschema:"Badge image URL (supports placeholders),required"`
	Name     string               `json:"name,omitempty" jsonschema:"Badge name"`
}

AddGroupInput is the input for adding a group badge.

type AddGroupOutput

type AddGroupOutput struct {
	toolutil.HintableOutput
	Badge BadgeItem `json:"badge"`
}

AddGroupOutput is the output after adding a group badge.

func AddGroup

func AddGroup(ctx context.Context, client *gitlabclient.Client, input AddGroupInput) (AddGroupOutput, error)

AddGroup adds a badge to a group.

type AddProjectInput

type AddProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	LinkURL   string               `json:"link_url" jsonschema:"Badge link URL (supports placeholders),required"`
	ImageURL  string               `json:"image_url" jsonschema:"Badge image URL (supports placeholders),required"`
	Name      string               `json:"name,omitempty" jsonschema:"Badge name"`
}

AddProjectInput is the input for adding a project badge.

type AddProjectOutput

type AddProjectOutput struct {
	toolutil.HintableOutput
	Badge BadgeItem `json:"badge"`
}

AddProjectOutput is the output after adding a project badge.

func AddProject

func AddProject(ctx context.Context, client *gitlabclient.Client, input AddProjectInput) (AddProjectOutput, error)

AddProject adds a badge to a project.

type BadgeItem

type BadgeItem struct {
	ID               int64  `json:"id"`
	Name             string `json:"name,omitempty"`
	LinkURL          string `json:"link_url"`
	ImageURL         string `json:"image_url"`
	RenderedLinkURL  string `json:"rendered_link_url,omitempty"`
	RenderedImageURL string `json:"rendered_image_url,omitempty"`
	Kind             string `json:"kind,omitempty"`
}

BadgeItem represents a badge in output.

type DeleteGroupInput

type DeleteGroupInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	BadgeID int64                `json:"badge_id" jsonschema:"Badge ID,required"`
}

DeleteGroupInput is the input for deleting a group badge.

type DeleteProjectInput

type DeleteProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	BadgeID   int64                `json:"badge_id" jsonschema:"Badge ID,required"`
}

DeleteProjectInput is the input for deleting a project badge.

type EditGroupInput

type EditGroupInput struct {
	GroupID  toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	BadgeID  int64                `json:"badge_id" jsonschema:"Badge ID,required"`
	LinkURL  string               `json:"link_url,omitempty" jsonschema:"New badge link URL"`
	ImageURL string               `json:"image_url,omitempty" jsonschema:"New badge image URL"`
	Name     string               `json:"name,omitempty" jsonschema:"New badge name. Use name, not new_name"`
}

EditGroupInput is the input for editing a group badge.

type EditGroupOutput

type EditGroupOutput struct {
	toolutil.HintableOutput
	Badge BadgeItem `json:"badge"`
}

EditGroupOutput is the output after editing a group badge.

func EditGroup

func EditGroup(ctx context.Context, client *gitlabclient.Client, input EditGroupInput) (EditGroupOutput, error)

EditGroup edits a group badge.

type EditProjectInput

type EditProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	BadgeID   int64                `json:"badge_id" jsonschema:"Badge ID,required"`
	LinkURL   string               `json:"link_url,omitempty" jsonschema:"New badge link URL"`
	ImageURL  string               `json:"image_url,omitempty" jsonschema:"New badge image URL"`
	Name      string               `json:"name,omitempty" jsonschema:"New badge name. Use name, not new_name"`
}

EditProjectInput is the input for editing a project badge.

type EditProjectOutput

type EditProjectOutput struct {
	toolutil.HintableOutput
	Badge BadgeItem `json:"badge"`
}

EditProjectOutput is the output after editing a project badge.

func EditProject

func EditProject(ctx context.Context, client *gitlabclient.Client, input EditProjectInput) (EditProjectOutput, error)

EditProject edits a project badge.

type GetGroupInput

type GetGroupInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	BadgeID int64                `json:"badge_id" jsonschema:"Badge ID,required"`
}

GetGroupInput is the input for getting a group badge.

type GetGroupOutput

type GetGroupOutput struct {
	toolutil.HintableOutput
	Badge BadgeItem `json:"badge"`
}

GetGroupOutput is the output for getting a group badge.

func GetGroup

func GetGroup(ctx context.Context, client *gitlabclient.Client, input GetGroupInput) (GetGroupOutput, error)

GetGroup gets a specific group badge.

type GetProjectInput

type GetProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	BadgeID   int64                `json:"badge_id" jsonschema:"Badge ID,required"`
}

GetProjectInput is the input for getting a project badge.

type GetProjectOutput

type GetProjectOutput struct {
	toolutil.HintableOutput
	Badge BadgeItem `json:"badge"`
}

GetProjectOutput is the output for getting a project badge.

func GetProject

func GetProject(ctx context.Context, client *gitlabclient.Client, input GetProjectInput) (GetProjectOutput, error)

GetProject gets a specific project badge.

type ListGroupInput

type ListGroupInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	Name    string               `json:"name,omitempty"     jsonschema:"Filter by badge name"`
	OrderBy string               `json:"order_by,omitempty" jsonschema:"Column to order results by for keyset pagination (e.g. id, name)"`
	Sort    string               `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListGroupInput is the input for listing group badges. Name maps onto gl.ListGroupBadgesOptions; OrderBy/Sort/pagination/page_token map onto the embedded gl.ListOptions and enable keyset pagination.

type ListGroupOutput

type ListGroupOutput struct {
	toolutil.HintableOutput
	Badges     []BadgeItem               `json:"badges"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListGroupOutput is the output for listing group badges.

func ListGroup

func ListGroup(ctx context.Context, client *gitlabclient.Client, input ListGroupInput) (ListGroupOutput, error)

ListGroup returns all badges for a group.

type ListProjectInput

type ListProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Name      string               `json:"name,omitempty"     jsonschema:"Filter by badge name"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order results by for keyset pagination (e.g. id, name)"`
	Sort      string               `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListProjectInput is the input for listing project badges. Name maps onto gl.ListProjectBadgesOptions; OrderBy/Sort/pagination/page_token map onto the embedded gl.ListOptions and enable keyset pagination.

type ListProjectOutput

type ListProjectOutput struct {
	toolutil.HintableOutput
	Badges     []BadgeItem               `json:"badges"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListProjectOutput is the output for listing project badges.

func ListProject

func ListProject(ctx context.Context, client *gitlabclient.Client, input ListProjectInput) (ListProjectOutput, error)

ListProject returns all badges for a project.

type PreviewGroupInput

type PreviewGroupInput struct {
	GroupID  toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	LinkURL  string               `json:"link_url" jsonschema:"Badge link URL with placeholders,required"`
	ImageURL string               `json:"image_url" jsonschema:"Badge image URL with placeholders,required"`
	Name     string               `json:"name,omitempty" jsonschema:"Badge name"`
}

PreviewGroupInput is the input for previewing a group badge.

type PreviewGroupOutput

type PreviewGroupOutput struct {
	toolutil.HintableOutput
	Badge BadgeItem `json:"badge"`
}

PreviewGroupOutput is the output for group badge preview.

func PreviewGroup

func PreviewGroup(ctx context.Context, client *gitlabclient.Client, input PreviewGroupInput) (PreviewGroupOutput, error)

PreviewGroup previews how group badge URLs render after placeholder resolution.

type PreviewProjectInput

type PreviewProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	LinkURL   string               `json:"link_url" jsonschema:"Badge link URL with placeholders,required"`
	ImageURL  string               `json:"image_url" jsonschema:"Badge image URL with placeholders,required"`
}

PreviewProjectInput is the input for previewing a project badge.

type PreviewProjectOutput

type PreviewProjectOutput struct {
	toolutil.HintableOutput
	Badge BadgeItem `json:"badge"`
}

PreviewProjectOutput is the output for badge preview.

func PreviewProject

func PreviewProject(ctx context.Context, client *gitlabclient.Client, input PreviewProjectInput) (PreviewProjectOutput, error)

PreviewProject previews how badge URLs render after placeholder resolution.

Jump to

Keyboard shortcuts

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