issuelinks

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package issuelinks implements MCP tools for GitLab issue link operations.

The package wraps the GitLab Issue links API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionSpecs

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

ActionSpecs returns canonical specs for issue link actions exposed as MCP tools. The list/get/create/delete routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).

func Delete

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

Delete removes an existing issue link from a GitLab project via the GitLab Issue links API (DELETE /projects/:id/issues/:issue_iid/links/:issue_link_id). Returns an error if the link is not found or the caller lacks Reporter role or higher.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a list of issue relations as a Markdown table.

func FormatOutputMarkdown

func FormatOutputMarkdown(v Output) string

FormatOutputMarkdown renders a single issue link as Markdown.

Types

type CreateInput

type CreateInput struct {
	ProjectID       toolutil.StringOrInt `json:"project_id" jsonschema:"Source project ID or URL-encoded path,required"`
	IssueIID        int                  `json:"issue_iid" jsonschema:"Source issue IID,required"`
	TargetProjectID string               `json:"target_project_id" jsonschema:"Target project ID or path,required"`
	TargetIssueIID  string               `json:"target_issue_iid" jsonschema:"Target issue IID,required"`
	LinkType        string               `json:"link_type" jsonschema:"Link type: relates_to (default), blocks, or is_blocked_by"`
}

CreateInput holds parameters for creating an issue link.

type DeleteInput

type DeleteInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID    int                  `json:"issue_iid" jsonschema:"Issue IID,required"`
	IssueLinkID int                  `json:"issue_link_id" jsonschema:"Issue link ID to remove,required"`
}

DeleteInput holds parameters for deleting an issue link.

type EpicOutput added in v2.3.0

type EpicOutput struct {
	ID                      int64       `json:"id"`
	IID                     int64       `json:"iid"`
	GroupID                 int64       `json:"group_id"`
	ParentID                int64       `json:"parent_id"`
	Title                   string      `json:"title"`
	Description             string      `json:"description"`
	State                   string      `json:"state"`
	Confidential            bool        `json:"confidential"`
	WebURL                  string      `json:"web_url"`
	URL                     string      `json:"url"`
	Author                  *UserOutput `json:"author,omitempty"`
	Labels                  []string    `json:"labels,omitempty"`
	Upvotes                 int64       `json:"upvotes,omitempty"`
	Downvotes               int64       `json:"downvotes,omitempty"`
	UserNotesCount          int64       `json:"user_notes_count,omitempty"`
	StartDate               string      `json:"start_date,omitempty"`
	StartDateIsFixed        bool        `json:"start_date_is_fixed,omitempty"`
	StartDateFixed          string      `json:"start_date_fixed,omitempty"`
	StartDateFromMilestones string      `json:"start_date_from_milestones,omitempty"`
	DueDate                 string      `json:"due_date,omitempty"`
	DueDateIsFixed          bool        `json:"due_date_is_fixed,omitempty"`
	DueDateFixed            string      `json:"due_date_fixed,omitempty"`
	DueDateFromMilestones   string      `json:"due_date_from_milestones,omitempty"`
	CreatedAt               string      `json:"created_at,omitempty"`
	UpdatedAt               string      `json:"updated_at,omitempty"`
	ClosedAt                string      `json:"closed_at,omitempty"`
}

EpicOutput mirrors gitlab.Epic (the epic associated with an issue, EE only).

type GetInput

type GetInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID    int                  `json:"issue_iid" jsonschema:"Issue IID,required"`
	IssueLinkID int                  `json:"issue_link_id" jsonschema:"Issue link ID,required"`
}

GetInput holds parameters for getting a specific issue link.

type IssueRefOutput added in v2.3.0

type IssueRefOutput struct {
	ID                   int64                       `json:"id"`
	IID                  int64                       `json:"iid"`
	ExternalID           string                      `json:"external_id,omitempty"`
	State                string                      `json:"state"`
	Description          string                      `json:"description,omitempty"`
	HealthStatus         string                      `json:"health_status,omitempty" tier:"ultimate"`
	Author               *UserOutput                 `json:"author,omitempty"`
	Milestone            *MilestoneOutput            `json:"milestone,omitempty"`
	ProjectID            int64                       `json:"project_id"`
	Assignees            []*UserOutput               `json:"assignees,omitempty"`
	Assignee             *UserOutput                 `json:"assignee,omitempty"`
	UpdatedAt            string                      `json:"updated_at,omitempty"`
	ClosedAt             string                      `json:"closed_at,omitempty"`
	ClosedBy             *UserOutput                 `json:"closed_by,omitempty"`
	Title                string                      `json:"title"`
	CreatedAt            string                      `json:"created_at,omitempty"`
	MovedToID            int64                       `json:"moved_to_id,omitempty"`
	Labels               []string                    `json:"labels,omitempty"`
	LabelDetails         []*LabelDetailsOutput       `json:"label_details,omitempty"`
	Upvotes              int64                       `json:"upvotes,omitempty"`
	Downvotes            int64                       `json:"downvotes,omitempty"`
	DueDate              string                      `json:"due_date,omitempty"`
	WebURL               string                      `json:"web_url"`
	References           *ReferencesOutput           `json:"references,omitempty"`
	TimeStats            *TimeStatsOutput            `json:"time_stats,omitempty"`
	Confidential         bool                        `json:"confidential"`
	Weight               int64                       `json:"weight,omitempty" tier:"premium"`
	DiscussionLocked     bool                        `json:"discussion_locked"`
	IssueType            string                      `json:"issue_type,omitempty"`
	Subscribed           bool                        `json:"subscribed"`
	UserNotesCount       int64                       `json:"user_notes_count,omitempty"`
	Links                *LinksOutput                `json:"_links,omitempty"`
	IssueLinkID          int64                       `json:"issue_link_id,omitempty"`
	MergeRequestCount    int64                       `json:"merge_requests_count,omitempty"`
	EpicIssueID          int64                       `json:"epic_issue_id,omitempty" tier:"premium"`
	Epic                 *EpicOutput                 `json:"epic,omitempty" tier:"premium"`
	Iteration            *IterationOutput            `json:"iteration,omitempty" tier:"premium"`
	TaskCompletionStatus *TaskCompletionStatusOutput `json:"task_completion_status,omitempty"`
	ServiceDeskReplyTo   string                      `json:"service_desk_reply_to,omitempty"`
}

IssueRefOutput mirrors the full gitlab.Issue struct surfaced for the source_issue and target_issue objects on a single issue link. Per the 1:1 audit policy (full nested objects) every field of the SDK Issue is surfaced with the correct type: user-like objects (author/assignees/assignee/ closed_by) as *UserOutput, and milestone/references/epic/iteration/ time_stats/task_completion_status/label_details/_links as their full local mirror objects. labels is surfaced as []string. The existing flattened SourceIssueIID/SourceProjectID/TargetIssueIID/TargetProjectID scalars on Output remain additive for ergonomic consumers.

type IterationOutput added in v2.3.0

type IterationOutput struct {
	ID          int64  `json:"id"`
	IID         int64  `json:"iid"`
	Sequence    int64  `json:"sequence"`
	GroupID     int64  `json:"group_id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	State       int64  `json:"state"`
	WebURL      string `json:"web_url"`
	CreatedAt   string `json:"created_at,omitempty"`
	UpdatedAt   string `json:"updated_at,omitempty"`
	StartDate   string `json:"start_date,omitempty"`
	DueDate     string `json:"due_date,omitempty"`
}

IterationOutput mirrors gitlab.GroupIteration (the iteration assigned to an issue, EE only).

type LabelDetailsOutput added in v2.3.0

type LabelDetailsOutput struct {
	ID              int64  `json:"id"`
	Name            string `json:"name"`
	Color           string `json:"color"`
	Description     string `json:"description"`
	DescriptionHTML string `json:"description_html"`
	TextColor       string `json:"text_color"`
}

LabelDetailsOutput mirrors gitlab.LabelDetails (a label object with full detail surfaced under the label_details key).

type LinksOutput added in v2.3.0

type LinksOutput struct {
	Self       string `json:"self"`
	Notes      string `json:"notes"`
	AwardEmoji string `json:"award_emoji"`
	Project    string `json:"project"`
}

LinksOutput mirrors gitlab.IssueLinks (the issue _links object).

type ListInput

type ListInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int                  `json:"issue_iid" jsonschema:"Issue IID,required"`
}

ListInput holds parameters for listing issue relations.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	Relations []RelationOutput `json:"relations"`
}

ListOutput represents a list of issue relations.

func List

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

List retrieves the list of issue relations (links) for a given issue from the GitLab Issue links API (GET /projects/:id/issues/:issue_iid/links). Returns a ListOutput with the linked issues or an error if the project or issue is not found.

type MilestoneOutput added in v2.3.0

type MilestoneOutput struct {
	ID          int64  `json:"id"`
	IID         int64  `json:"iid"`
	GroupID     int64  `json:"group_id"`
	ProjectID   int64  `json:"project_id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	StartDate   string `json:"start_date,omitempty"`
	DueDate     string `json:"due_date,omitempty"`
	State       string `json:"state"`
	WebURL      string `json:"web_url"`
	UpdatedAt   string `json:"updated_at,omitempty"`
	CreatedAt   string `json:"created_at,omitempty"`
	Expired     *bool  `json:"expired,omitempty"`
}

MilestoneOutput mirrors gitlab.Milestone (the milestone object attached to an issue relation).

type Output

type Output struct {
	toolutil.HintableOutput
	ID          int             `json:"id"`
	LinkType    string          `json:"link_type"`
	SourceIssue *IssueRefOutput `json:"source_issue,omitempty"`
	TargetIssue *IssueRefOutput `json:"target_issue,omitempty"`
}

Output represents a single issue link. It mirrors the gitlab.IssueLink struct (id, source_issue, target_issue, link_type). SourceIssue and TargetIssue surface the full SDK issue objects (1:1 audit policy, full nested objects).

func Create

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

Create creates a new issue link between a source issue and a target issue via the GitLab Issue links API (POST /projects/:id/issues/:issue_iid/links). The link may be of type "relates_to" (default), "blocks", or "is_blocked_by" and may target an issue in a different project.

func Get

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

Get retrieves a single issue link by its ID from the GitLab Issue links API (GET /projects/:id/issues/:issue_iid/links/:issue_link_id). Returns the link details including source and target issue metadata.

type ReferencesOutput added in v2.3.0

type ReferencesOutput struct {
	Short    string `json:"short"`
	Relative string `json:"relative"`
	Full     string `json:"full"`
}

ReferencesOutput mirrors gitlab.IssueReferences (the issue references object).

type RelationOutput

type RelationOutput struct {
	ID             int               `json:"id"`
	IID            int               `json:"iid"`
	State          string            `json:"state"`
	Description    string            `json:"description,omitempty"`
	Confidential   bool              `json:"confidential"`
	Author         *UserOutput       `json:"author,omitempty"`
	Milestone      *MilestoneOutput  `json:"milestone,omitempty"`
	ProjectID      int               `json:"project_id"`
	Assignees      []*UserOutput     `json:"assignees,omitempty"`
	Assignee       *UserOutput       `json:"assignee,omitempty"`
	UpdatedAt      string            `json:"updated_at,omitempty"`
	Title          string            `json:"title"`
	CreatedAt      string            `json:"created_at,omitempty"`
	Labels         []string          `json:"labels,omitempty"`
	DueDate        string            `json:"due_date,omitempty"`
	WebURL         string            `json:"web_url"`
	References     *ReferencesOutput `json:"references,omitempty"`
	Weight         int64             `json:"weight,omitempty" tier:"premium"`
	UserNotesCount int64             `json:"user_notes_count,omitempty"`
	IssueLinkID    int               `json:"issue_link_id"`
	LinkType       string            `json:"link_type"`
	LinkCreatedAt  string            `json:"link_created_at,omitempty"`
	LinkUpdatedAt  string            `json:"link_updated_at,omitempty"`
}

RelationOutput represents a related issue from the list endpoint. It mirrors the full gitlab.IssueRelation struct: author/assignee/assignees/milestone/ references are surfaced as full nested objects and labels as a []string (1:1 audit policy).

type TaskCompletionStatusOutput added in v2.3.0

type TaskCompletionStatusOutput struct {
	Count          int64 `json:"count"`
	CompletedCount int64 `json:"completed_count"`
}

TaskCompletionStatusOutput mirrors gitlab.TasksCompletionStatus.

type TimeStatsOutput added in v2.3.0

type TimeStatsOutput struct {
	HumanTimeEstimate   string `json:"human_time_estimate"`
	HumanTotalTimeSpent string `json:"human_total_time_spent"`
	TimeEstimate        int64  `json:"time_estimate"`
	TotalTimeSpent      int64  `json:"total_time_spent"`
}

TimeStatsOutput mirrors gitlab.TimeStats (the issue time-tracking object).

type UserOutput added in v2.3.0

type UserOutput struct {
	ID        int64  `json:"id"`
	State     string `json:"state"`
	WebURL    string `json:"web_url"`
	Name      string `json:"name"`
	AvatarURL string `json:"avatar_url"`
	Username  string `json:"username"`
}

UserOutput mirrors gitlab.IssueAuthor / gitlab.IssueAssignee (they share the same shape). It surfaces the full user sub-object referenced by an issue relation's author and assignees.

Jump to

Keyboard shortcuts

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