containerregistry

package
v1.0.3 Latest Latest
Warning

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

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

Documentation

Overview

Package containerregistry implements MCP tools for GitLab container registry operations using the ContainerRegistryService API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteProtectionRule

func DeleteProtectionRule(ctx context.Context, client *gitlabclient.Client, input DeleteProtectionRuleInput) error

DeleteProtectionRule deletes a container registry protection rule.

func DeleteRepository

func DeleteRepository(ctx context.Context, client *gitlabclient.Client, input DeleteRepositoryInput) error

DeleteRepository deletes a container registry repository.

func DeleteTag

func DeleteTag(ctx context.Context, client *gitlabclient.Client, input DeleteTagInput) error

DeleteTag deletes a single registry repository tag.

func DeleteTagsBulk

func DeleteTagsBulk(ctx context.Context, client *gitlabclient.Client, input DeleteTagsBulkInput) error

DeleteTagsBulk deletes registry repository tags in bulk using regex patterns.

func FormatProtectionRuleListMarkdown

func FormatProtectionRuleListMarkdown(out ProtectionRuleListOutput) string

FormatProtectionRuleListMarkdown formats a list of protection rules.

func FormatProtectionRuleMarkdown

func FormatProtectionRuleMarkdown(out ProtectionRuleOutput) string

FormatProtectionRuleMarkdown formats a single protection rule as markdown.

func FormatRepositoryListMarkdown

func FormatRepositoryListMarkdown(out RepositoryListOutput) string

FormatRepositoryListMarkdown formats a list of registry repositories.

func FormatRepositoryMarkdown

func FormatRepositoryMarkdown(out RepositoryOutput) string

FormatRepositoryMarkdown formats a single registry repository as markdown.

func FormatTagListMarkdown

func FormatTagListMarkdown(out TagListOutput) string

FormatTagListMarkdown formats a list of registry tags.

func FormatTagMarkdown

func FormatTagMarkdown(out TagOutput) string

FormatTagMarkdown formats a single registry tag as markdown.

func RegisterMeta

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

RegisterMeta registers the gitlab_registry and gitlab_registry_protection meta-tools.

func RegisterTools

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

RegisterTools registers all container registry MCP tools.

Types

type CreateProtectionRuleInput

type CreateProtectionRuleInput struct {
	ProjectID                   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	RepositoryPathPattern       string               `json:"repository_path_pattern" jsonschema:"Repository path pattern (e.g. my-project/my-image*),required"`
	MinimumAccessLevelForPush   string               `json:"minimum_access_level_for_push,omitempty" jsonschema:"Minimum access level for push (maintainer, owner, admin)"`
	MinimumAccessLevelForDelete string               `json:"minimum_access_level_for_delete,omitempty" jsonschema:"Minimum access level for delete (maintainer, owner, admin)"`
}

CreateProtectionRuleInput represents the input for creating a protection rule.

type DeleteProtectionRuleInput

type DeleteProtectionRuleInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	RuleID    int64                `json:"rule_id" jsonschema:"Protection rule ID,required"`
}

DeleteProtectionRuleInput represents the input for deleting a protection rule.

type DeleteRepositoryInput

type DeleteRepositoryInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	RepositoryID int64                `json:"repository_id" jsonschema:"Registry repository ID,required"`
}

DeleteRepositoryInput represents the input for deleting a registry repository.

type DeleteTagInput

type DeleteTagInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	RepositoryID int64                `json:"repository_id" jsonschema:"Registry repository ID,required"`
	TagName      string               `json:"tag_name" jsonschema:"Tag name to delete,required"`
}

DeleteTagInput represents the input for deleting a single registry tag.

type DeleteTagsBulkInput

type DeleteTagsBulkInput struct {
	ProjectID       toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	RepositoryID    int64                `json:"repository_id" jsonschema:"Registry repository ID,required"`
	NameRegexDelete string               `json:"name_regex_delete,omitempty" jsonschema:"Regex pattern of tag names to delete"`
	NameRegexKeep   string               `json:"name_regex_keep,omitempty" jsonschema:"Regex pattern of tag names to keep"`
	KeepN           int64                `json:"keep_n,omitempty" jsonschema:"Number of latest tags to keep"`
	OlderThan       string               `json:"older_than,omitempty" jsonschema:"Delete tags older than this (e.g. 1h, 2d, 1month)"`
}

DeleteTagsBulkInput represents the input for bulk deleting registry tags.

type GetRepositoryInput

type GetRepositoryInput struct {
	RepositoryID int64 `json:"repository_id" jsonschema:"Registry repository ID,required"`
	Tags         bool  `json:"tags,omitempty" jsonschema:"Include tags in response"`
	TagsCount    bool  `json:"tags_count,omitempty" jsonschema:"Include tags count in response"`
}

GetRepositoryInput represents the input for getting a single registry repository.

type GetTagInput

type GetTagInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	RepositoryID int64                `json:"repository_id" jsonschema:"Registry repository ID,required"`
	TagName      string               `json:"tag_name" jsonschema:"Tag name,required"`
}

GetTagInput represents the input for getting a registry tag detail.

type ListGroupInput

type ListGroupInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or path,required"`
	Page    int                  `json:"page,omitempty" jsonschema:"Page number for pagination"`
	PerPage int                  `json:"per_page,omitempty" jsonschema:"Number of items per page"`
}

ListGroupInput represents the input for listing group registry repositories.

type ListProjectInput

type ListProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	Tags      bool                 `json:"tags,omitempty" jsonschema:"Include tags in response"`
	TagsCount bool                 `json:"tags_count,omitempty" jsonschema:"Include tags count in response"`
	Page      int                  `json:"page,omitempty" jsonschema:"Page number for pagination"`
	PerPage   int                  `json:"per_page,omitempty" jsonschema:"Number of items per page"`
}

ListProjectInput represents the input for listing project registry repositories.

type ListProtectionRulesInput

type ListProtectionRulesInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
}

ListProtectionRulesInput represents the input for listing protection rules.

type ListTagsInput

type ListTagsInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	RepositoryID int64                `json:"repository_id" jsonschema:"Registry repository ID,required"`
	Page         int                  `json:"page,omitempty" jsonschema:"Page number for pagination"`
	PerPage      int                  `json:"per_page,omitempty" jsonschema:"Number of items per page"`
}

ListTagsInput represents the input for listing registry repository tags.

type ProtectionRuleListOutput

type ProtectionRuleListOutput struct {
	toolutil.HintableOutput
	Rules      []ProtectionRuleOutput    `json:"rules"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ProtectionRuleListOutput represents a list of protection rules.

func ListProtectionRules

func ListProtectionRules(ctx context.Context, client *gitlabclient.Client, input ListProtectionRulesInput) (ProtectionRuleListOutput, error)

ListProtectionRules lists container registry protection rules for a project.

type ProtectionRuleOutput

type ProtectionRuleOutput struct {
	toolutil.HintableOutput
	ID                          int64  `json:"id"`
	ProjectID                   int64  `json:"project_id"`
	RepositoryPathPattern       string `json:"repository_path_pattern"`
	MinimumAccessLevelForPush   string `json:"minimum_access_level_for_push"`
	MinimumAccessLevelForDelete string `json:"minimum_access_level_for_delete"`
}

ProtectionRuleOutput represents a container registry protection rule.

func CreateProtectionRule

func CreateProtectionRule(ctx context.Context, client *gitlabclient.Client, input CreateProtectionRuleInput) (ProtectionRuleOutput, error)

CreateProtectionRule creates a container registry protection rule.

func UpdateProtectionRule

func UpdateProtectionRule(ctx context.Context, client *gitlabclient.Client, input UpdateProtectionRuleInput) (ProtectionRuleOutput, error)

UpdateProtectionRule updates a container registry protection rule.

type RepositoryListOutput

type RepositoryListOutput struct {
	toolutil.HintableOutput
	Repositories []RepositoryOutput        `json:"repositories"`
	Pagination   toolutil.PaginationOutput `json:"pagination"`
}

RepositoryListOutput represents a paginated list of registry repositories.

func ListGroup

ListGroup lists container registry repositories for a group.

func ListProject

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

ListProject lists container registry repositories for a project.

type RepositoryOutput

type RepositoryOutput struct {
	toolutil.HintableOutput
	ID                     int64  `json:"id"`
	Name                   string `json:"name"`
	Path                   string `json:"path"`
	ProjectID              int64  `json:"project_id"`
	Location               string `json:"location"`
	CreatedAt              string `json:"created_at,omitempty"`
	CleanupPolicyStartedAt string `json:"cleanup_policy_started_at,omitempty"`
	Status                 string `json:"status,omitempty"`
	TagsCount              int64  `json:"tags_count"`
}

RepositoryOutput represents a container registry repository.

func GetRepository

func GetRepository(ctx context.Context, client *gitlabclient.Client, input GetRepositoryInput) (RepositoryOutput, error)

GetRepository gets details of a single registry repository by its ID.

type TagListOutput

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

TagListOutput represents a paginated list of registry tags.

func ListTags

func ListTags(ctx context.Context, client *gitlabclient.Client, input ListTagsInput) (TagListOutput, error)

ListTags lists tags for a registry repository.

type TagOutput

type TagOutput struct {
	toolutil.HintableOutput
	Name          string `json:"name"`
	Path          string `json:"path"`
	Location      string `json:"location"`
	Revision      string `json:"revision,omitempty"`
	ShortRevision string `json:"short_revision,omitempty"`
	Digest        string `json:"digest,omitempty"`
	CreatedAt     string `json:"created_at,omitempty"`
	TotalSize     int64  `json:"total_size"`
}

TagOutput represents a container registry image tag.

func GetTag

func GetTag(ctx context.Context, client *gitlabclient.Client, input GetTagInput) (TagOutput, error)

GetTag gets details of a specific registry repository tag.

type UpdateProtectionRuleInput

type UpdateProtectionRuleInput struct {
	ProjectID                   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or path,required"`
	RuleID                      int64                `json:"rule_id" jsonschema:"Protection rule ID,required"`
	RepositoryPathPattern       string               `json:"repository_path_pattern,omitempty" jsonschema:"Repository path pattern"`
	MinimumAccessLevelForPush   string               `json:"minimum_access_level_for_push,omitempty" jsonschema:"Minimum access level for push (maintainer, owner, admin)"`
	MinimumAccessLevelForDelete string               `json:"minimum_access_level_for_delete,omitempty" jsonschema:"Minimum access level for delete (maintainer, owner, admin)"`
}

UpdateProtectionRuleInput represents the input for updating a protection rule.

Jump to

Keyboard shortcuts

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