tags

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: 11 Imported by: 0

Documentation

Overview

Package tags implements GitLab tag and protected tag operations including create, delete, get, list, signature, protect, and unprotect.

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 tag from the specified GitLab project.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) *mcp.CallToolResult

FormatListMarkdown renders a list of tags as an MCP CallToolResult.

func FormatListMarkdownString

func FormatListMarkdownString(out ListOutput) string

FormatListMarkdownString renders a list of tags as a Markdown table.

func FormatListProtectedTagsMarkdown

func FormatListProtectedTagsMarkdown(out ListProtectedTagsOutput) *mcp.CallToolResult

FormatListProtectedTagsMarkdown renders a list of protected tags as an MCP CallToolResult.

func FormatListProtectedTagsMarkdownString

func FormatListProtectedTagsMarkdownString(out ListProtectedTagsOutput) string

FormatListProtectedTagsMarkdownString renders a list of protected tags as Markdown.

func FormatOutputMarkdown

func FormatOutputMarkdown(t Output) *mcp.CallToolResult

FormatOutputMarkdown renders a single tag as an MCP CallToolResult.

func FormatOutputMarkdownString

func FormatOutputMarkdownString(t Output) string

FormatOutputMarkdownString renders a single tag as a Markdown summary.

func FormatProtectedTagMarkdown

func FormatProtectedTagMarkdown(out ProtectedTagOutput) *mcp.CallToolResult

FormatProtectedTagMarkdown renders a protected tag as an MCP CallToolResult.

func FormatProtectedTagMarkdownString

func FormatProtectedTagMarkdownString(out ProtectedTagOutput) string

FormatProtectedTagMarkdownString renders a protected tag as Markdown.

func FormatSignatureMarkdown

func FormatSignatureMarkdown(out SignatureOutput) *mcp.CallToolResult

FormatSignatureMarkdown renders a tag signature as an MCP CallToolResult.

func FormatSignatureMarkdownString

func FormatSignatureMarkdownString(out SignatureOutput) string

FormatSignatureMarkdownString renders a tag signature as a Markdown summary.

func RegisterTools

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

RegisterTools registers Git tag tools on the MCP server.

func UnprotectTag

func UnprotectTag(ctx context.Context, client *gitlabclient.Client, input UnprotectTagInput) error

UnprotectTag removes protection from a repository tag.

Types

type CreateInput

type CreateInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	TagName   string               `json:"tag_name"   jsonschema:"Name of the tag,required"`
	Ref       string               `json:"ref"        jsonschema:"Commit SHA, branch name, or another tag to create the tag from,required"`
	Message   string               `json:"message,omitempty" jsonschema:"Creates an annotated tag with this message"`
}

CreateInput defines parameters for creating a Git tag.

type DeleteInput

type DeleteInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	TagName   string               `json:"tag_name"   jsonschema:"Name of the tag to delete,required"`
}

DeleteInput defines parameters for deleting a tag.

type GetInput

type GetInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	TagName   string               `json:"tag_name"   jsonschema:"Tag name to retrieve,required"`
}

GetInput defines parameters for retrieving a single tag.

type GetProtectedTagInput

type GetProtectedTagInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	TagName   string               `json:"tag_name"   jsonschema:"Name of the protected tag,required"`
}

GetProtectedTagInput defines parameters for retrieving a single protected tag.

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:"Search query to filter tags by name"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Order tags by field (name, updated)"`
	Sort      string               `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
}

ListInput defines parameters for listing tags.

type ListOutput

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

ListOutput holds a list of tags.

func List

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

List retrieves a paginated list of tags for the specified GitLab project.

type ListProtectedTagsInput

type ListProtectedTagsInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	toolutil.PaginationInput
}

ListProtectedTagsInput defines parameters for listing protected tags.

type ListProtectedTagsOutput

type ListProtectedTagsOutput struct {
	toolutil.HintableOutput
	Tags       []ProtectedTagOutput      `json:"tags"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListProtectedTagsOutput holds a list of protected tags.

func ListProtectedTags

func ListProtectedTags(ctx context.Context, client *gitlabclient.Client, input ListProtectedTagsInput) (ListProtectedTagsOutput, error)

ListProtectedTags retrieves a paginated list of protected tags for a project.

type Output

type Output struct {
	toolutil.HintableOutput
	Name          string `json:"name"`
	Target        string `json:"target"`
	Message       string `json:"message"`
	Protected     bool   `json:"protected"`
	CommitSHA     string `json:"commit_sha,omitempty"`
	CommitMessage string `json:"commit_message,omitempty"`
	CreatedAt     string `json:"created_at,omitempty"`
}

Output represents a Git tag.

func Create

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

Create creates a new Git tag in the specified GitLab project.

func Get

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

Get retrieves a single tag by name from a GitLab project.

type ProtectTagInput

type ProtectTagInput struct {
	ProjectID         toolutil.StringOrInt `json:"project_id"          jsonschema:"Project ID or URL-encoded path,required"`
	TagName           string               `json:"tag_name"             jsonschema:"Tag name or wildcard pattern (e.g. 'v*'),required"`
	CreateAccessLevel int                  `json:"create_access_level,omitempty" jsonschema:"Access level allowed to create (0=No access, 30=Developer, 40=Maintainer)"`
	AllowedToCreate   []TagPermission      `json:"allowed_to_create,omitempty"  jsonschema:"Granular create permissions (user_id, group_id, deploy_key_id, access_level)"`
}

ProtectTagInput defines parameters for protecting a tag.

type ProtectedTagOutput

type ProtectedTagOutput struct {
	toolutil.HintableOutput
	Name               string                 `json:"name"`
	CreateAccessLevels []TagAccessLevelOutput `json:"create_access_levels"`
}

ProtectedTagOutput represents a protected tag.

func GetProtectedTag

func GetProtectedTag(ctx context.Context, client *gitlabclient.Client, input GetProtectedTagInput) (ProtectedTagOutput, error)

GetProtectedTag retrieves a single protected tag by name.

func ProtectTag

func ProtectTag(ctx context.Context, client *gitlabclient.Client, input ProtectTagInput) (ProtectedTagOutput, error)

ProtectTag protects tag for the tags package.

type SignatureInput

type SignatureInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	TagName   string               `json:"tag_name"   jsonschema:"Tag name to retrieve signature for,required"`
}

SignatureInput defines parameters for retrieving the X.509 signature of a tag.

type SignatureOutput

type SignatureOutput struct {
	toolutil.HintableOutput
	SignatureType      string                `json:"signature_type"`
	VerificationStatus string                `json:"verification_status"`
	X509Certificate    X509CertificateOutput `json:"x509_certificate"`
}

SignatureOutput represents the X.509 signature of a tag.

func GetSignature

func GetSignature(ctx context.Context, client *gitlabclient.Client, input SignatureInput) (SignatureOutput, error)

GetSignature retrieves the X.509 signature of a tag.

type TagAccessLevelOutput

type TagAccessLevelOutput struct {
	ID                     int64  `json:"id"`
	AccessLevel            int    `json:"access_level"`
	AccessLevelDescription string `json:"access_level_description"`
	UserID                 int64  `json:"user_id,omitempty"`
	GroupID                int64  `json:"group_id,omitempty"`
	DeployKeyID            int64  `json:"deploy_key_id,omitempty"`
}

TagAccessLevelOutput represents access level description for a protected tag.

type TagPermission

type TagPermission struct {
	UserID      int64 `json:"user_id,omitempty"      jsonschema:"User ID allowed to create"`
	GroupID     int64 `json:"group_id,omitempty"      jsonschema:"Group ID allowed to create"`
	DeployKeyID int64 `json:"deploy_key_id,omitempty" jsonschema:"Deploy key ID allowed to create"`
	AccessLevel int   `json:"access_level,omitempty"  jsonschema:"Access level (0, 30, 40)"`
}

TagPermission represents a granular permission option for protected tags.

type UnprotectTagInput

type UnprotectTagInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	TagName   string               `json:"tag_name"   jsonschema:"Name of the protected tag to unprotect,required"`
}

UnprotectTagInput defines parameters for unprotecting a tag.

type X509CertificateOutput

type X509CertificateOutput struct {
	ID                   int64            `json:"id"`
	Subject              string           `json:"subject"`
	SubjectKeyIdentifier string           `json:"subject_key_identifier"`
	Email                string           `json:"email"`
	SerialNumber         string           `json:"serial_number"`
	CertificateStatus    string           `json:"certificate_status"`
	X509Issuer           X509IssuerOutput `json:"x509_issuer"`
}

X509CertificateOutput represents an X.509 certificate.

type X509IssuerOutput

type X509IssuerOutput struct {
	ID                   int64  `json:"id"`
	Subject              string `json:"subject"`
	SubjectKeyIdentifier string `json:"subject_key_identifier"`
	CrlURL               string `json:"crl_url,omitempty"`
}

X509IssuerOutput represents an X.509 certificate issuer.

Jump to

Keyboard shortcuts

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