releases

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package releases implements MCP tool handlers for GitLab release operations including create, update, delete, get, and list. It wraps the Releases service from client-go v2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a list of releases as a Markdown table.

func FormatMarkdown

func FormatMarkdown(r Output) string

FormatMarkdown renders a single release as a Markdown summary.

func RegisterTools

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

RegisterTools registers all release-related MCP tools on the given server. Each tool is configured with appropriate annotations indicating whether the operation is read-only or destructive.

Types

type AssetSourceOutput

type AssetSourceOutput struct {
	Format string `json:"format"`
	URL    string `json:"url"`
}

AssetSourceOutput represents a single release asset source (auto-generated archive).

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:"Tag name associated with the release,required"`
	Name        string               `json:"name,omitempty"        jsonschema:"Release title"`
	Description string               `json:"description,omitempty" jsonschema:"Release notes (Markdown supported)"`
	ReleasedAt  string               `json:"released_at,omitempty" jsonschema:"Date of the release in ISO 8601 format"`
	Ref         string               `json:"ref,omitempty"         jsonschema:"Branch or commit SHA to create tag from (if tag does not exist)"`
	Milestones  []string             `json:"milestones,omitempty"  jsonschema:"Milestone titles to associate with the release"`
	TagMessage  string               `json:"tag_message,omitempty" jsonschema:"Message to use for the annotated tag (creates annotated tag instead of lightweight)"`
}

CreateInput defines parameters for creating a GitLab release.

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:"Tag name of the release to delete,required"`
}

DeleteInput defines parameters for deleting a release.

type EvidenceOutput

type EvidenceOutput struct {
	SHA         string `json:"sha"`
	Filepath    string `json:"filepath"`
	CollectedAt string `json:"collected_at,omitempty"`
}

EvidenceOutput represents a release evidence record.

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 of the release,required"`
}

GetInput defines parameters for getting a release.

type GetLatestInput

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

GetLatestInput defines parameters for retrieving the latest release.

type ListInput

type ListInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Order by field (released_at, created_at)"`
	Sort      string               `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
}

ListInput defines parameters for listing releases.

type ListOutput

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

ListOutput holds a list of releases.

func List

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

List returns a paginated list of releases for a GitLab project. Results can be ordered by released_at or created_at and sorted ascending or descending.

type Output

type Output struct {
	toolutil.HintableOutput
	TagName         string                `json:"tag_name"`
	Name            string                `json:"name"`
	Description     string                `json:"description"`
	DescriptionHTML string                `json:"description_html,omitempty"`
	CreatedAt       string                `json:"created_at"`
	ReleasedAt      string                `json:"released_at"`
	Author          string                `json:"author,omitempty"`
	CommitSHA       string                `json:"commit_sha,omitempty"`
	UpcomingRelease bool                  `json:"upcoming_release,omitempty"`
	Milestones      []string              `json:"milestones,omitempty"`
	CommitPath      string                `json:"commit_path,omitempty"`
	TagPath         string                `json:"tag_path,omitempty"`
	AssetsCount     int64                 `json:"assets_count,omitempty"`
	AssetsSources   []AssetSourceOutput   `json:"assets_sources,omitempty"`
	AssetsLinks     []releaselinks.Output `json:"assets_links,omitempty"`
	Evidences       []EvidenceOutput      `json:"evidences,omitempty"`
	WebURL          string                `json:"web_url,omitempty"`
}

Output represents a GitLab release.

func Create

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

Create creates a new release in a GitLab project for the specified tag. Returns the created release details or an error if the tag is not found.

func Delete

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

Delete removes a release from a GitLab project by tag name. Returns the deleted release details or an error if the release does not exist.

func Get

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

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

func GetLatest

func GetLatest(ctx context.Context, client *gitlabclient.Client, input GetLatestInput) (Output, error)

GetLatest retrieves the latest release for a GitLab project.

func ToOutput

func ToOutput(r *gl.Release) Output

ToOutput converts a GitLab API gl.Release to the MCP tool output format, formatting timestamps as RFC 3339 strings.

func Update

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

Update modifies an existing release identified by project and tag name. Only non-empty fields in the input are applied as updates.

type UpdateInput

type UpdateInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id"            jsonschema:"Project ID or URL-encoded path,required"`
	TagName     string               `json:"tag_name"              jsonschema:"Tag name of the release,required"`
	Name        string               `json:"name,omitempty"        jsonschema:"New release title"`
	Description string               `json:"description,omitempty" jsonschema:"Updated release notes"`
	ReleasedAt  string               `json:"released_at,omitempty" jsonschema:"New release date in ISO 8601 format"`
	Milestones  []string             `json:"milestones,omitempty"  jsonschema:"Milestone titles to associate with the release"`
}

UpdateInput defines parameters for updating a release.

Jump to

Keyboard shortcuts

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