issues

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package issues implements MCP tools for GitLab issue lifecycle operations.

The package covers project issue CRUD, listing, filtering, assignee and author queries, confidentiality, labels, milestones, due dates, state changes, and issue links to related tool domains such as notes, discussions, statistics, and work items. Handlers return typed MCP output structs and publish Markdown formatters for individual and meta-tool responses.

GitLab API References

The primary API backing this package is:

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 lifecycle actions exposed as MCP tools. The create, read, update, delete, reorder, move, subscribe, todo, and time-tracking routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004).

func AuthorName added in v2.3.0

func AuthorName(i Output) string

AuthorName returns the issue author's display username for Markdown, read from the full author object. It is exported so sibling packages (e.g. mergerequests) that embed Output in their own tables can render the author without reaching into the object.

func Delete

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

Delete permanently removes an issue from a GitLab project. Returns an error if the issue does not exist or the user lacks permission.

func FormatListAllMarkdown

func FormatListAllMarkdown(out ListOutput) string

FormatListAllMarkdown renders a list of globally-scoped issues as a Markdown table.

func FormatListGroupMarkdown

func FormatListGroupMarkdown(out ListGroupOutput) string

FormatListGroupMarkdown renders a paginated list of group issues as a Markdown table.

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a list of issues as a Markdown table.

func FormatMarkdown

func FormatMarkdown(i Output) string

FormatMarkdown renders a single issue as a Markdown summary.

func FormatParticipantsMarkdown

func FormatParticipantsMarkdown(out ParticipantsOutput) string

FormatParticipantsMarkdown renders an issue's participant list as Markdown.

func FormatRelatedMRsMarkdown

func FormatRelatedMRsMarkdown(out RelatedMRsOutput, heading string) string

FormatRelatedMRsMarkdown renders a list of related merge requests as Markdown.

func FormatTimeStatsMarkdown

func FormatTimeStatsMarkdown(ts TimeStatsOutput) string

FormatTimeStatsMarkdown renders time tracking statistics as Markdown.

func FormatTodoMarkdown

func FormatTodoMarkdown(t TodoOutput) string

FormatTodoMarkdown renders a to-do item as a Markdown summary.

func GroupActionSpecs

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

GroupActionSpecs returns canonical specs for issue actions exposed through the group meta-tool surface. Currently scoped to group issue listing.

Types

type AddSpentTimeInput

type AddSpentTimeInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid"  jsonschema:"Issue internal ID,required"`
	Duration  string               `json:"duration"   jsonschema:"Human-readable duration (e.g. 1h, 30m, 1w2d),required"`
	Summary   string               `json:"summary,omitempty" jsonschema:"Optional summary of work done"`
}

AddSpentTimeInput defines parameters for adding spent time to an issue.

type CreateInput

type CreateInput struct {
	// Basic metadata
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	Title       string               `json:"title" jsonschema:"Issue title,required"`
	IID         int64                `` /* 143-byte string literal not displayed */
	Description string               `json:"description,omitempty" jsonschema:"Issue description (Markdown supported)"`
	IssueType   string               `json:"issue_type,omitempty" jsonschema:"Issue type (issue, incident, test_case, task)"`

	// Assignment and tracking
	AssigneeID  int64    `json:"assignee_id,omitempty" jsonschema:"Single user ID to assign (use assignee_ids for multiple)"`
	AssigneeIDs []int64  `json:"assignee_ids,omitempty" jsonschema:"User IDs to assign"`
	Labels      []string `json:"labels,omitempty" jsonschema:"Label names to apply"`
	MilestoneID int64    `json:"milestone_id,omitempty" jsonschema:"Milestone ID to associate"`
	EpicID      int64    `json:"epic_id,omitempty" tier:"premium" jsonschema:"Epic ID to associate the issue with"`
	Weight      int64    `json:"weight,omitempty" tier:"premium" jsonschema:"Issue weight, 0 or higher"`
	DueDate     string   `json:"due_date,omitempty" jsonschema:"Due date in YYYY-MM-DD format"`

	// Behavior flags
	Confidential *bool  `json:"confidential,omitempty" jsonschema:"Mark issue as confidential"`
	CreatedAt    string `json:"created_at,omitempty" jsonschema:"Creation date override (ISO 8601, requires admin permissions)"`

	// Discussion resolution
	MergeRequestToResolveDiscussionsOf int64  `json:"merge_request_to_resolve_discussions_of,omitempty" jsonschema:"MR IID whose unresolved discussions become issues"`
	DiscussionToResolve                string `json:"discussion_to_resolve,omitempty" jsonschema:"Discussion ID to mark as resolved by this issue"`
}

CreateInput defines parameters for creating a new issue.

type CreateTodoInput

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

CreateTodoInput defines parameters for creating a to-do for an issue.

type DeleteInput

type DeleteInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid"  jsonschema:"Issue IID (project-scoped internal ID, not 'issue_id'),required"`
}

DeleteInput defines parameters for deleting an issue.

type GetByIDInput

type GetByIDInput struct {
	IssueID int64 `json:"issue_id" jsonschema:"The global issue ID (not the project-scoped IID),required"`
}

GetByIDInput defines parameters for retrieving an issue by its global ID.

type GetInput

type GetInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid"  jsonschema:"Issue IID (project-scoped internal ID, not 'issue_id'),required"`
}

GetInput defines parameters for retrieving a single issue.

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 gl.GroupIteration.

type ListAllInput

type ListAllInput struct {
	State               string   `json:"state,omitempty"                jsonschema:"Filter by state (opened, closed, all)"`
	Labels              []string `json:"labels,omitempty"               jsonschema:"Label names to filter by"`
	NotLabels           []string `json:"not_labels,omitempty"           jsonschema:"Label names to exclude"`
	WithLabelsDetails   *bool    `json:"with_labels_details,omitempty"  jsonschema:"Return label objects with full details instead of just names"`
	Milestone           string   `json:"milestone,omitempty"            jsonschema:"Milestone title to filter by"`
	NotMilestone        string   `json:"not_milestone,omitempty"        jsonschema:"Milestone title to exclude"`
	Scope               string   `json:"scope,omitempty"                jsonschema:"Filter by scope (created_by_me, assigned_to_me, all)"`
	Search              string   `json:"search,omitempty"               jsonschema:"Search in title and description"`
	NotSearch           string   `json:"not_search,omitempty"           jsonschema:"Exclude issues matching this search text"`
	In                  string   `` /* 128-byte string literal not displayed */
	NotIn               string   `json:"not_in,omitempty"               jsonschema:"Fields the negated search query applies to (title, description)"`
	AssigneeID          *int64   `json:"assignee_id,omitempty"          jsonschema:"Filter by assignee user ID"`
	NotAssigneeID       []int64  `json:"not_assignee_id,omitempty"      jsonschema:"Exclude issues assigned to these user IDs"`
	AssigneeUsername    string   `json:"assignee_username,omitempty"    jsonschema:"Filter by assignee username"`
	NotAssigneeUsername string   `json:"not_assignee_username,omitempty" jsonschema:"Exclude issues assigned to this username"`
	AuthorID            *int64   `json:"author_id,omitempty"            jsonschema:"Filter by author user ID"`
	NotAuthorID         []int64  `json:"not_author_id,omitempty"        jsonschema:"Exclude issues authored by these user IDs"`
	AuthorUsername      string   `json:"author_username,omitempty"      jsonschema:"Filter by author username"`
	NotAuthorUsername   string   `json:"not_author_username,omitempty"  jsonschema:"Exclude issues authored by this username"`
	MyReactionEmoji     string   `json:"my_reaction_emoji,omitempty"    jsonschema:"Filter by issues you reacted to with this emoji (or None/Any)"`
	NotMyReactionEmoji  []string `json:"not_my_reaction_emoji,omitempty" jsonschema:"Exclude issues you reacted to with these emoji"`
	IIDs                []int64  `json:"iids,omitempty"                 jsonschema:"Filter by issue internal IDs"`
	IssueType           string   `json:"issue_type,omitempty"           jsonschema:"Filter by issue type (issue, incident, test_case, task)"`
	IterationID         *int64   `json:"iteration_id,omitempty"         tier:"premium" jsonschema:"Filter by iteration ID"`
	Confidential        *bool    `json:"confidential,omitempty"         jsonschema:"Filter by confidential status"`
	DueDate             string   `` /* 130-byte string literal not displayed */
	OrderBy             string   `` /* 180-byte string literal not displayed */
	Sort                string   `json:"sort,omitempty"                 jsonschema:"Sort direction (asc, desc)"`
	CreatedAfter        string   `json:"created_after,omitempty"        jsonschema:"Return issues created after date (ISO 8601)"`
	CreatedBefore       string   `json:"created_before,omitempty"       jsonschema:"Return issues created before date (ISO 8601)"`
	UpdatedAfter        string   `json:"updated_after,omitempty"        jsonschema:"Return issues updated after date (ISO 8601)"`
	UpdatedBefore       string   `json:"updated_before,omitempty"       jsonschema:"Return issues updated before date (ISO 8601)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListAllInput defines parameters for the global ListIssues endpoint (no project scope).

type ListGroupInput

type ListGroupInput struct {
	GroupID             toolutil.StringOrInt `json:"group_id"                       jsonschema:"Group ID or URL-encoded path,required"`
	State               string               `json:"state,omitempty"                jsonschema:"Filter by state (opened, closed, all)"`
	Labels              []string             `json:"labels,omitempty"               jsonschema:"Label names to filter by"`
	NotLabels           []string             `json:"not_labels,omitempty"           jsonschema:"Label names to exclude"`
	WithLabelsDetails   *bool                `json:"with_labels_details,omitempty"  jsonschema:"Return label objects with full details instead of just names"`
	Milestone           string               `json:"milestone,omitempty"            jsonschema:"Milestone title to filter by"`
	NotMilestone        string               `json:"not_milestone,omitempty"        jsonschema:"Milestone title to exclude"`
	Scope               string               `json:"scope,omitempty"                jsonschema:"Scope (created_by_me, assigned_to_me, all)"`
	Search              string               `json:"search,omitempty"               jsonschema:"Search in title and description"`
	NotSearch           string               `json:"not_search,omitempty"           jsonschema:"Exclude issues matching this search text"`
	In                  string               `` /* 128-byte string literal not displayed */
	NotIn               string               `json:"not_in,omitempty"               jsonschema:"Fields the negated search query applies to (title, description)"`
	AssigneeID          *int64               `json:"assignee_id,omitempty"          jsonschema:"Filter by assignee user ID"`
	NotAssigneeID       *int64               `json:"not_assignee_id,omitempty"      jsonschema:"Exclude issues assigned to this user ID"`
	AssigneeUsername    string               `json:"assignee_username,omitempty"    jsonschema:"Filter by assignee username"`
	NotAssigneeUsername string               `json:"not_assignee_username,omitempty" jsonschema:"Exclude issues assigned to this username"`
	AuthorID            *int64               `json:"author_id,omitempty"            jsonschema:"Filter by author user ID"`
	NotAuthorID         *int64               `json:"not_author_id,omitempty"        jsonschema:"Exclude issues authored by this user ID"`
	AuthorUsername      string               `json:"author_username,omitempty"      jsonschema:"Filter by author username"`
	NotAuthorUsername   string               `json:"not_author_username,omitempty"  jsonschema:"Exclude issues authored by this username"`
	MyReactionEmoji     string               `json:"my_reaction_emoji,omitempty"    jsonschema:"Filter by issues you reacted to with this emoji (or None/Any)"`
	NotMyReactionEmoji  string               `json:"not_my_reaction_emoji,omitempty" jsonschema:"Exclude issues you reacted to with this emoji"`
	IIDs                []int64              `json:"iids,omitempty"                 jsonschema:"Filter by issue internal IDs"`
	IssueType           string               `json:"issue_type,omitempty"           jsonschema:"Filter by issue type (issue, incident, test_case, task)"`
	IterationID         *int64               `json:"iteration_id,omitempty"         tier:"premium" jsonschema:"Filter by iteration ID"`
	Confidential        *bool                `json:"confidential,omitempty"         jsonschema:"Filter by confidential status"`
	DueDate             string               `` /* 130-byte string literal not displayed */
	OrderBy             string               `` /* 180-byte string literal not displayed */
	Sort                string               `json:"sort,omitempty"                 jsonschema:"Sort direction (asc, desc)"`
	CreatedAfter        string               `json:"created_after,omitempty"        jsonschema:"Return issues created after date (ISO 8601)"`
	CreatedBefore       string               `json:"created_before,omitempty"       jsonschema:"Return issues created before date (ISO 8601)"`
	UpdatedAfter        string               `json:"updated_after,omitempty"        jsonschema:"Return issues updated after date (ISO 8601)"`
	UpdatedBefore       string               `json:"updated_before,omitempty"       jsonschema:"Return issues updated before date (ISO 8601)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListGroupInput defines parameters for listing issues across a group.

type ListGroupOutput

type ListGroupOutput struct {
	toolutil.HintableOutput
	Issues     []Output                  `json:"issues"`
	Pagination toolutil.PaginationOutput `json:"pagination"`
}

ListGroupOutput holds a paginated list of group issues.

func ListGroup

func ListGroup(ctx context.Context, client *gitlabclient.Client, input ListGroupInput) (ListGroupOutput, error)

ListGroup retrieves a paginated list of issues across all projects in a group.

type ListInput

type ListInput struct {
	ProjectID           toolutil.StringOrInt `json:"project_id"                     jsonschema:"Project ID or URL-encoded path,required"`
	State               string               `json:"state,omitempty"                jsonschema:"Filter by state (opened, closed, all)"`
	Labels              []string             `json:"labels,omitempty"               jsonschema:"Label names to filter by"`
	NotLabels           []string             `json:"not_labels,omitempty"           jsonschema:"Label names to exclude"`
	WithLabelsDetails   *bool                `` /* 142-byte string literal not displayed */
	Milestone           string               `json:"milestone,omitempty"            jsonschema:"Milestone title to filter by"`
	NotMilestone        string               `json:"not_milestone,omitempty"        jsonschema:"Milestone title to exclude"`
	Scope               string               `json:"scope,omitempty"                jsonschema:"Filter by scope (created_by_me, assigned_to_me, all)"`
	Search              string               `json:"search,omitempty"               jsonschema:"Search in title and description"`
	In                  string               `` /* 128-byte string literal not displayed */
	NotIn               string               `json:"not_in,omitempty"               jsonschema:"Fields the negated search query applies to (title, description)"`
	AssigneeID          *int64               `json:"assignee_id,omitempty"          jsonschema:"Filter by assignee user ID"`
	NotAssigneeID       *int64               `json:"not_assignee_id,omitempty"      jsonschema:"Exclude issues assigned to this user ID"`
	AssigneeUsername    string               `json:"assignee_username,omitempty"    jsonschema:"Filter by assignee username"`
	NotAssigneeUsername string               `json:"not_assignee_username,omitempty" jsonschema:"Exclude issues assigned to this username"`
	AuthorID            *int64               `json:"author_id,omitempty"            jsonschema:"Filter by author user ID"`
	NotAuthorID         *int64               `json:"not_author_id,omitempty"        jsonschema:"Exclude issues authored by this user ID"`
	AuthorUsername      string               `json:"author_username,omitempty"      jsonschema:"Filter by author username"`
	NotAuthorUsername   string               `json:"not_author_username,omitempty"  jsonschema:"Exclude issues authored by this username"`
	MyReactionEmoji     string               `` /* 127-byte string literal not displayed */
	NotMyReactionEmoji  string               `json:"not_my_reaction_emoji,omitempty" jsonschema:"Exclude issues you reacted to with this emoji"`
	IIDs                []int64              `json:"iids,omitempty"                 jsonschema:"Filter by issue internal IDs"`
	IssueType           string               `json:"issue_type,omitempty"           jsonschema:"Filter by issue type (issue, incident, test_case, task)"`
	IterationID         *int64               `json:"iteration_id,omitempty"         tier:"premium" jsonschema:"Filter by iteration ID"`
	Confidential        *bool                `json:"confidential,omitempty"         jsonschema:"Filter by confidential status"`
	DueDate             string               `` /* 142-byte string literal not displayed */
	CreatedAfter        string               `` /* 128-byte string literal not displayed */
	CreatedBefore       string               `` /* 129-byte string literal not displayed */
	UpdatedAfter        string               `` /* 128-byte string literal not displayed */
	UpdatedBefore       string               `` /* 129-byte string literal not displayed */
	OrderBy             string               `` /* 180-byte string literal not displayed */
	Sort                string               `json:"sort,omitempty"                 jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListInput defines filters for listing project issues.

type ListMRsClosingInput

type ListMRsClosingInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id"         jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid"          jsonschema:"Issue internal ID,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order results by (e.g. created_at, updated_at)"`
	Sort      string               `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListMRsClosingInput defines parameters for listing MRs that close an issue on merge.

type ListMRsRelatedInput

type ListMRsRelatedInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id"         jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid"          jsonschema:"Issue internal ID,required"`
	OrderBy   string               `json:"order_by,omitempty" jsonschema:"Column to order results by (e.g. created_at, updated_at)"`
	Sort      string               `json:"sort,omitempty"     jsonschema:"Sort direction (asc, desc)"`
	toolutil.PaginationInput
	toolutil.KeysetPaginationInput
}

ListMRsRelatedInput defines parameters for listing MRs related to an issue.

type ListOutput

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

ListOutput holds a paginated list of issues.

func List

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

List retrieves a paginated list of issues for a GitLab project. Supports filtering by state, labels, milestone, search text, assignee, author, negation filters, iteration, and sorting. Returns the issues with pagination metadata.

func ListAll

func ListAll(ctx context.Context, client *gitlabclient.Client, input ListAllInput) (ListOutput, error)

ListAll retrieves a paginated list of issues visible to the authenticated user across all projects (global scope).

type MoveInput

type MoveInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id"     jsonschema:"Source project ID or URL-encoded path,required"`
	IssueIID    int64                `json:"issue_iid"      jsonschema:"Issue internal ID,required"`
	ToProjectID int64                `json:"to_project_id"  jsonschema:"Target project ID to move issue to,required"`
}

MoveInput defines parameters for moving an issue to another project.

type Output

type Output struct {
	toolutil.HintableOutput
	ID int64 `json:"id"`
	// IID is the issue's own project-scoped internal ID, mirroring the SDK
	// json key `iid`. Distinct from the global `id`.
	IID         int64    `` /* 161-byte string literal not displayed */
	Title       string   `json:"title"`
	Description string   `json:"description"`
	State       string   `json:"state"`
	Labels      []string `json:"labels"`
	// Author is the full author object mirrored from the SDK (1:1 fidelity).
	Author *toolutil.IssueUserOutput `json:"author,omitempty"`
	// Assignees is the list of full assignee objects mirrored from the SDK.
	Assignees []*toolutil.IssueUserOutput `json:"assignees"`
	// Assignee is the singular (deprecated upstream) assignee object.
	Assignee *toolutil.IssueUserOutput `json:"assignee,omitempty"`
	// Milestone is the full milestone object mirrored from the SDK.
	Milestone *toolutil.MRMilestoneOutput `json:"milestone,omitempty"`
	// ClosedBy is the full closer object mirrored from the SDK.
	ClosedBy          *toolutil.IssueUserOutput `json:"closed_by,omitempty"`
	WebURL            string                    `json:"web_url"`
	CreatedAt         string                    `json:"created_at"`
	UpdatedAt         string                    `json:"updated_at"`
	ClosedAt          string                    `json:"closed_at"`
	DueDate           string                    `json:"due_date"`
	Confidential      bool                      `json:"confidential"`
	DiscussionLocked  bool                      `json:"discussion_locked"`
	ProjectID         int64                     `json:"project_id"`
	Weight            int64                     `json:"weight,omitempty" tier:"premium"`
	IssueType         string                    `json:"issue_type,omitempty"`
	HealthStatus      string                    `json:"health_status,omitempty" tier:"ultimate"`
	MergeRequestCount int64                     `json:"merge_requests_count,omitempty"`
	UserNotesCount    int64                     `json:"user_notes_count,omitempty"`
	Upvotes           int64                     `json:"upvotes,omitempty"`
	Downvotes         int64                     `json:"downvotes,omitempty"`
	Subscribed        bool                      `json:"subscribed"`
	MovedToID         int64                     `json:"moved_to_id,omitempty"`
	EpicIssueID       int64                     `json:"epic_issue_id,omitempty" tier:"premium"`
	// Additive 1:1 fields surfaced from the SDK Issue (full sub-objects and
	// scalars not previously exposed).
	ExternalID           string                               `json:"external_id,omitempty"`
	IssueLinkID          int64                                `json:"issue_link_id,omitempty"`
	ServiceDeskReplyTo   string                               `json:"service_desk_reply_to,omitempty"`
	References           *toolutil.ReferencesOutput           `json:"references,omitempty"`
	Epic                 *toolutil.EpicOutput                 `json:"epic,omitempty" tier:"premium"`
	LabelDetails         []*toolutil.LabelDetailsOutput       `json:"label_details,omitempty"`
	Iteration            *toolutil.IterationOutput            `json:"iteration,omitempty" tier:"premium"`
	Links                *toolutil.IssueLinksOutput           `json:"_links,omitempty"`
	TimeStats            *TimeStatsOutput                     `json:"time_stats,omitempty"`
	TaskCompletionStatus *toolutil.TaskCompletionStatusOutput `json:"task_completion_status,omitempty"`
}

Output represents a GitLab issue.

func Create

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

Create creates a new issue in the specified GitLab project. It maps all optional fields (description, labels, assignees, milestone, due date, confidential) to the GitLab API request. Returns the created issue or an error if the API call fails.

func Get

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

Get retrieves a single issue by its internal ID from a GitLab project. Returns the issue details or an error if the issue is not found.

func GetByID

func GetByID(ctx context.Context, client *gitlabclient.Client, input GetByIDInput) (Output, error)

GetByID retrieves a single issue by its global numeric ID.

func Move

func Move(ctx context.Context, client *gitlabclient.Client, input MoveInput) (Output, error)

Move moves an issue from one project to another.

func Reorder

func Reorder(ctx context.Context, client *gitlabclient.Client, input ReorderInput) (Output, error)

Reorder changes the position of an issue relative to other issues.

func Subscribe

func Subscribe(ctx context.Context, client *gitlabclient.Client, input SubscribeInput) (Output, error)

Subscribe subscribes the authenticated user to an issue for notifications.

func ToOutput

func ToOutput(issue *gl.Issue) Output

ToOutput converts a GitLab API gl.Issue to the MCP tool output format, extracting author, milestone, assignees, and formatting timestamps as RFC 3339 strings. Nil labels are normalized to an empty slice.

func Unsubscribe

func Unsubscribe(ctx context.Context, client *gitlabclient.Client, input UnsubscribeInput) (Output, error)

Unsubscribe removes the authenticated user's subscription from an issue.

func Update

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

Update modifies an existing issue in a GitLab project. Only non-zero fields in the input are applied. Supports changing title, description, state, assignees, labels (replace, add, remove), milestone, due date, and confidential flag. Returns the updated issue.

type ParticipantOutput

type ParticipantOutput struct {
	ID       int64  `json:"id"`
	Username string `json:"username"`
	Name     string `json:"name"`
	WebURL   string `json:"web_url"`
}

ParticipantOutput represents a participant in an issue.

type ParticipantsOutput

type ParticipantsOutput struct {
	toolutil.HintableOutput
	Participants []ParticipantOutput `json:"participants"`
}

ParticipantsOutput holds a list of issue participants.

func GetParticipants

func GetParticipants(ctx context.Context, client *gitlabclient.Client, input GetInput) (ParticipantsOutput, error)

GetParticipants retrieves the list of participants in an issue.

type RelatedMROutput

type RelatedMROutput struct {
	ID                          int64                                `json:"id"`
	IID                         int64                                `json:"iid"`
	ProjectID                   int64                                `json:"project_id"`
	Title                       string                               `json:"title"`
	State                       string                               `json:"state"`
	Description                 string                               `json:"description"`
	SourceBranch                string                               `json:"source_branch"`
	TargetBranch                string                               `json:"target_branch"`
	SourceProjectID             int64                                `json:"source_project_id"`
	TargetProjectID             int64                                `json:"target_project_id"`
	Author                      *toolutil.BasicUserOutput            `json:"author"`
	Assignee                    *toolutil.BasicUserOutput            `json:"assignee"`
	Assignees                   []*toolutil.BasicUserOutput          `json:"assignees"`
	Reviewers                   []*toolutil.BasicUserOutput          `json:"reviewers"`
	MergeUser                   *toolutil.BasicUserOutput            `json:"merge_user"`
	MergedBy                    *toolutil.BasicUserOutput            `json:"merged_by"`
	ClosedBy                    *toolutil.BasicUserOutput            `json:"closed_by"`
	Milestone                   *toolutil.MRMilestoneOutput          `json:"milestone"`
	Labels                      []string                             `json:"labels"`
	LabelDetails                []*toolutil.LabelDetailsOutput       `json:"label_details"`
	References                  *toolutil.ReferencesOutput           `json:"references"`
	TimeStats                   *TimeStatsOutput                     `json:"time_stats"`
	TaskCompletionStatus        *toolutil.TaskCompletionStatusOutput `json:"task_completion_status"`
	Draft                       bool                                 `json:"draft"`
	Imported                    bool                                 `json:"imported"`
	ImportedFrom                string                               `json:"imported_from"`
	DetailedMergeStatus         string                               `json:"detailed_merge_status"`
	MergeWhenPipelineSucceeds   bool                                 `json:"merge_when_pipeline_succeeds"`
	SHA                         string                               `json:"sha"`
	MergeCommitSHA              string                               `json:"merge_commit_sha"`
	SquashCommitSHA             string                               `json:"squash_commit_sha"`
	Squash                      bool                                 `json:"squash"`
	SquashOnMerge               bool                                 `json:"squash_on_merge"`
	ShouldRemoveSourceBranch    bool                                 `json:"should_remove_source_branch"`
	ForceRemoveSourceBranch     bool                                 `json:"force_remove_source_branch"`
	AllowCollaboration          bool                                 `json:"allow_collaboration"`
	AllowMaintainerToPush       bool                                 `json:"allow_maintainer_to_push"`
	DiscussionLocked            bool                                 `json:"discussion_locked"`
	HasConflicts                bool                                 `json:"has_conflicts"`
	BlockingDiscussionsResolved bool                                 `json:"blocking_discussions_resolved"`
	Upvotes                     int64                                `json:"upvotes"`
	Downvotes                   int64                                `json:"downvotes"`
	UserNotesCount              int64                                `json:"user_notes_count"`
	CreatedAt                   string                               `json:"created_at,omitempty"`
	UpdatedAt                   string                               `json:"updated_at,omitempty"`
	MergedAt                    string                               `json:"merged_at,omitempty"`
	MergeAfter                  string                               `json:"merge_after,omitempty"`
	PreparedAt                  string                               `json:"prepared_at,omitempty"`
	ClosedAt                    string                               `json:"closed_at,omitempty"`
	WebURL                      string                               `json:"web_url"`
}

RelatedMROutput mirrors gl.BasicMergeRequest, the merge-request object returned by the closing-MR and related-MR issue endpoints. Per the 1:1 audit policy it surfaces every SDK field with the correct type: user objects (author, assignee, assignees, reviewers, merge_user, merged_by, closed_by) are full *toolutil.BasicUserOutput/[]*toolutil.BasicUserOutput rather than flattened usernames, and milestone/references/time_stats/task_completion_status/ label_details are full nested objects reusing the issue sub-object shapes.

The canonical author key carries the full user object. The MR's own internal id is surfaced on iid (the BasicMergeRequest.iid field).

type RelatedMRsOutput

type RelatedMRsOutput struct {
	toolutil.HintableOutput
	MergeRequests []RelatedMROutput         `json:"merge_requests"`
	Pagination    toolutil.PaginationOutput `json:"pagination"`
}

RelatedMRsOutput holds a paginated list of merge requests related to an issue.

func ListMRsClosing

func ListMRsClosing(ctx context.Context, client *gitlabclient.Client, input ListMRsClosingInput) (RelatedMRsOutput, error)

ListMRsClosing retrieves merge requests that will close this issue on merge.

func ListMRsRelated

func ListMRsRelated(ctx context.Context, client *gitlabclient.Client, input ListMRsRelatedInput) (RelatedMRsOutput, error)

ListMRsRelated retrieves merge requests related to this issue.

type ReorderInput

type ReorderInput struct {
	ProjectID    toolutil.StringOrInt `json:"project_id"              jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID     int64                `json:"issue_iid"               jsonschema:"Issue internal ID,required"`
	MoveAfterID  *int64               `json:"move_after_id,omitempty"  jsonschema:"ID of issue to position after"`
	MoveBeforeID *int64               `json:"move_before_id,omitempty" jsonschema:"ID of issue to position before"`
}

ReorderInput defines parameters for reordering an issue.

type SetTimeEstimateInput

type SetTimeEstimateInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID  int64                `json:"issue_iid"  jsonschema:"Issue internal ID,required"`
	Duration  string               `json:"duration"   jsonschema:"Human-readable duration (e.g. 3h30m, 1w2d),required"`
}

SetTimeEstimateInput defines parameters for setting a time estimate on an issue.

type SubscribeInput

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

SubscribeInput defines parameters for subscribing to an issue.

type TimeStatsOutput

type TimeStatsOutput struct {
	toolutil.HintableOutput
	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 represents time tracking statistics for an issue.

func AddSpentTime

func AddSpentTime(ctx context.Context, client *gitlabclient.Client, input AddSpentTimeInput) (TimeStatsOutput, error)

AddSpentTime adds spent time for an issue.

func GetTimeStats

func GetTimeStats(ctx context.Context, client *gitlabclient.Client, input GetInput) (TimeStatsOutput, error)

GetTimeStats retrieves total time tracking statistics for an issue.

func ResetSpentTime

func ResetSpentTime(ctx context.Context, client *gitlabclient.Client, input GetInput) (TimeStatsOutput, error)

ResetSpentTime resets the total spent time for an issue.

func ResetTimeEstimate

func ResetTimeEstimate(ctx context.Context, client *gitlabclient.Client, input GetInput) (TimeStatsOutput, error)

ResetTimeEstimate resets the time estimate for an issue back to zero.

func SetTimeEstimate

func SetTimeEstimate(ctx context.Context, client *gitlabclient.Client, input SetTimeEstimateInput) (TimeStatsOutput, error)

SetTimeEstimate sets the time estimate for an issue.

type TodoOutput

type TodoOutput struct {
	toolutil.HintableOutput
	ID          int64  `json:"id"`
	ActionName  string `json:"action_name"`
	TargetType  string `json:"target_type"`
	TargetTitle string `json:"target_title"`
	TargetURL   string `json:"target_url"`
	Body        string `json:"body,omitempty"`
	State       string `json:"state"`
	CreatedAt   string `json:"created_at,omitempty"`
}

TodoOutput represents a to-do item created from an issue.

func CreateTodo

func CreateTodo(ctx context.Context, client *gitlabclient.Client, input CreateTodoInput) (TodoOutput, error)

CreateTodo creates a to-do item for the authenticated user on the specified issue.

type UnsubscribeInput

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

UnsubscribeInput defines parameters for unsubscribing from an issue.

type UpdateInput

type UpdateInput struct {
	ProjectID        toolutil.StringOrInt `json:"project_id"              jsonschema:"Project ID or URL-encoded path,required"`
	IssueIID         int64                `json:"issue_iid"               jsonschema:"Issue IID (project-scoped internal ID, not 'issue_id'),required"`
	Title            string               `json:"title,omitempty"         jsonschema:"New title"`
	Description      string               `json:"description,omitempty"   jsonschema:"New description (Markdown supported)"`
	StateEvent       string               `json:"state_event,omitempty"   jsonschema:"State transition (close, reopen)"`
	AssigneeID       int64                `json:"assignee_id,omitempty"       jsonschema:"Single user ID to assign (use assignee_ids for multiple)"`
	AssigneeIDs      []int64              `json:"assignee_ids,omitempty"  jsonschema:"New assignee user IDs"`
	Labels           []string             `json:"labels,omitempty"        jsonschema:"Label names to replace all existing"`
	AddLabels        []string             `json:"add_labels,omitempty"    jsonschema:"Label names to add without removing existing"`
	RemoveLabels     []string             `json:"remove_labels,omitempty" jsonschema:"Label names to remove"`
	EpicID           int64                `json:"epic_id,omitempty"       tier:"premium" jsonschema:"Epic ID to associate"`
	MilestoneID      *int64               `json:"milestone_id,omitempty"  jsonschema:"New milestone ID (0 to unset; omit to leave unchanged)"`
	DueDate          string               `json:"due_date,omitempty"      jsonschema:"New due date in YYYY-MM-DD format"`
	Confidential     *bool                `json:"confidential,omitempty"  jsonschema:"Update confidential flag"`
	IssueType        string               `json:"issue_type,omitempty"    jsonschema:"Issue type (issue, incident, test_case, task)"`
	Weight           int64                `json:"weight,omitempty"        tier:"premium" jsonschema:"Issue weight, 0 or higher"`
	DiscussionLocked *bool                `json:"discussion_locked,omitempty" jsonschema:"Lock discussions on this issue"`
	UpdatedAt        string               `json:"updated_at,omitempty"    jsonschema:"Update timestamp override (ISO 8601/RFC 3339, requires admin permissions)"`
}

UpdateInput defines parameters for updating an existing issue.

Jump to

Keyboard shortcuts

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