releaselinks

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

markdown.go provides Markdown formatting functions for release link MCP tool output.

register.go wires releaselinks MCP tools to the MCP server.

Package releaselinks implements MCP tool handlers for GitLab release asset link operations including create, create batch, delete, get, and list. It wraps the ReleaseLinks service from client-go v2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBatchMarkdown

func FormatBatchMarkdown(out CreateBatchOutput) string

FormatBatchMarkdown renders the result of a batch link creation as Markdown.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a list of release asset links as a Markdown table.

func FormatOutputMarkdown

func FormatOutputMarkdown(l Output) string

FormatOutputMarkdown renders a single release asset link as Markdown.

func RegisterTools

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

RegisterTools registers MCP tools for GitLab release link operations.

Types

type CreateBatchInput

type CreateBatchInput 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"`
	Links     []LinkEntry          `json:"links"      jsonschema:"Array of links to create (each with name and url required),required"`
}

CreateBatchInput defines parameters for creating multiple release asset links in a single tool call.

type CreateBatchOutput

type CreateBatchOutput struct {
	toolutil.HintableOutput
	Created []Output `json:"created"`
	Failed  []string `json:"failed,omitempty"`
}

CreateBatchOutput holds the results of a batch link creation.

func CreateBatch

func CreateBatch(ctx context.Context, client *gitlabclient.Client, input CreateBatchInput) (CreateBatchOutput, error)

CreateBatch adds multiple asset links to a release in a single tool call. Each link is created sequentially; failures are collected without aborting the remaining links.

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 of the release,required"`
	Name      string               `json:"name"       jsonschema:"Name of the link,required"`
	URL       string               `` /* 162-byte string literal not displayed */
	LinkType  string               `json:"link_type,omitempty" jsonschema:"Type of the link (runbook, package, image, other)"`
}

CreateInput defines parameters for adding a release asset link.

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,required"`
	LinkID    int64                `json:"link_id"    jsonschema:"ID of the release link to delete,required"`
}

DeleteInput defines parameters for deleting a release link.

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"`
	LinkID    int64                `json:"link_id"    jsonschema:"ID of the release link,required"`
}

GetInput defines parameters for retrieving a single release link.

type LinkEntry

type LinkEntry struct {
	Name     string `json:"name"                jsonschema:"Name of the link,required"`
	URL      string `json:"url"                 jsonschema:"URL of the link target,required"`
	LinkType string `json:"link_type,omitempty"  jsonschema:"Type of the link (runbook, package, image, other)"`
}

LinkEntry describes a single link to create in a batch operation.

type ListInput

type ListInput 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"`
	toolutil.PaginationInput
}

ListInput defines parameters for listing release links.

type ListOutput

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

ListOutput holds a list of release asset links.

func List

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

List returns a paginated list of asset links for a release identified by project and tag name.

type Output

type Output struct {
	toolutil.HintableOutput
	ID             int64  `json:"id"`
	Name           string `json:"name"`
	URL            string `json:"url"`
	LinkType       string `json:"link_type"`
	External       bool   `json:"external"`
	DirectAssetURL string `json:"direct_asset_url,omitempty"`
}

Output represents a release asset link.

func Create

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

Create adds a new asset link to a release identified by project and tag name. The link type defaults to "other" if not specified.

func Delete

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

Delete removes an asset link from a release by its link ID. Returns the deleted link details or an error if the link does not exist.

func Get

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

Get retrieves a single release asset link by its ID.

func ToOutput

func ToOutput(l *gl.ReleaseLink) Output

ToOutput converts a GitLab API gl.ReleaseLink to the MCP tool output format.

func Update

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

Update modifies an existing release asset link. Only non-empty fields are applied.

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"`
	LinkID          int64                `json:"link_id"                   jsonschema:"ID of the release link to update,required"`
	Name            string               `json:"name,omitempty"            jsonschema:"New name of the link"`
	URL             string               `json:"url,omitempty"             jsonschema:"New URL of the link"`
	FilePath        string               `json:"filepath,omitempty"        jsonschema:"New filepath for a direct asset link"`
	DirectAssetPath string               `json:"direct_asset_path,omitempty" jsonschema:"New direct asset path for the link"`
	LinkType        string               `json:"link_type,omitempty"       jsonschema:"New link type (runbook, package, image, other)"`
}

UpdateInput defines parameters for updating a release link.

Jump to

Keyboard shortcuts

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