Documentation
¶
Overview ¶
Package workitems implements MCP tool handlers for GitLab Work Items. It wraps the WorkItemsService from client-go v2.
NOTE: The Work Items API is experimental and may introduce breaking changes even between minor GitLab versions.
Index ¶
- func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
- func FormatGetMarkdown(out GetOutput) *mcp.CallToolResult
- func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
- func RegisterTools(server *mcp.Server, client *gitlabclient.Client)
- type CreateInput
- type CreateLinkedItems
- type DeleteInput
- type GetInput
- type GetOutput
- type LinkedItem
- type ListInput
- type ListOutput
- type UpdateInput
- type WorkItemItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
Delete permanently removes a work item by IID.
func FormatGetMarkdown ¶
func FormatGetMarkdown(out GetOutput) *mcp.CallToolResult
FormatGetMarkdown formats a single work item as markdown.
func FormatListMarkdown ¶
func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
FormatListMarkdown formats a list of work items as markdown.
func RegisterTools ¶
func RegisterTools(server *mcp.Server, client *gitlabclient.Client)
RegisterTools registers all work item tools on the MCP server.
Types ¶
type CreateInput ¶
type CreateInput struct {
FullPath string `json:"full_path" jsonschema:"Full path of the project or group,required"`
WorkItemTypeID string `json:"work_item_type_id" jsonschema:"Global ID of work item type (e.g. gid://gitlab/WorkItems::Type/1 for Issue),required"`
Title string `json:"title" jsonschema:"Title of the work item,required"`
Description string `json:"description,omitempty" jsonschema:"Description of the work item"`
Confidential *bool `json:"confidential,omitempty" jsonschema:"Whether the work item is confidential"`
AssigneeIDs []int64 `json:"assignee_ids,omitempty" jsonschema:"Global IDs of assignees"`
MilestoneID *int64 `json:"milestone_id,omitempty" jsonschema:"Global ID of the milestone"`
LabelIDs []int64 `json:"label_ids,omitempty" jsonschema:"Global IDs of labels"`
Weight *int64 `json:"weight,omitempty" jsonschema:"Weight of the work item"`
HealthStatus string `json:"health_status,omitempty" jsonschema:"Health status (onTrack/needsAttention/atRisk)"`
Color string `json:"color,omitempty" jsonschema:"Color hex code (e.g. #fefefe)"`
DueDate string `json:"due_date,omitempty" jsonschema:"Due date (YYYY-MM-DD)"`
StartDate string `json:"start_date,omitempty" jsonschema:"Start date (YYYY-MM-DD)"`
LinkedItems *CreateLinkedItems `json:"linked_items,omitempty" jsonschema:"Linked work items to add on creation"`
}
CreateInput is the input for creating a work item.
type CreateLinkedItems ¶
type CreateLinkedItems struct {
WorkItemIDs []int64 `json:"work_item_ids" jsonschema:"Global IDs of work items to link,required"`
LinkType string `json:"link_type" jsonschema:"Link type: BLOCKS, BLOCKED_BY, or RELATED,required"`
}
CreateLinkedItems specifies work items to link during creation.
type DeleteInput ¶
type DeleteInput struct {
FullPath string `json:"full_path" jsonschema:"Full path of the project or group (e.g. my-group/my-project),required"`
IID int64 `json:"iid" jsonschema:"Work item IID,required"`
}
DeleteInput is the input for deleting a work item.
type GetInput ¶
type GetInput struct {
FullPath string `json:"full_path" jsonschema:"Full path of the project or group (e.g. my-group/my-project),required"`
IID int64 `json:"iid" jsonschema:"Work item IID,required"`
}
GetInput is the input for getting a single work item.
type GetOutput ¶
type GetOutput struct {
toolutil.HintableOutput
WorkItem WorkItemItem `json:"work_item"`
}
GetOutput is the output for getting a single work item.
func Create ¶
func Create(ctx context.Context, client *gitlabclient.Client, input CreateInput) (GetOutput, error)
Create creates a new work item.
func Update ¶
func Update(ctx context.Context, client *gitlabclient.Client, input UpdateInput) (GetOutput, error)
Update modifies an existing work item.
type LinkedItem ¶
type LinkedItem struct {
IID int64 `json:"iid"`
LinkType string `json:"link_type"`
Path string `json:"path,omitempty"`
}
LinkedItem represents a linked work item summary.
type ListInput ¶
type ListInput struct {
FullPath string `json:"full_path" jsonschema:"Full path of the project or group,required"`
State string `json:"state,omitempty" jsonschema:"Filter by state (opened/closed/all)"`
Search string `json:"search,omitempty" jsonschema:"Search in title and description"`
Types []string `json:"types,omitempty" jsonschema:"Filter by work item types"`
AuthorUsername string `json:"author_username,omitempty" jsonschema:"Filter by author username"`
LabelName []string `json:"label_name,omitempty" jsonschema:"Filter by label names"`
Confidential *bool `json:"confidential,omitempty" jsonschema:"Filter by confidentiality"`
Sort string `json:"sort,omitempty" jsonschema:"Sort order"`
First *int64 `json:"first,omitempty" jsonschema:"Number of items to return (cursor-based pagination)"`
After string `json:"after,omitempty" jsonschema:"Cursor for forward pagination"`
IncludeAncestors *bool `json:"include_ancestors,omitempty" jsonschema:"Include ancestor work items"`
IncludeDescendants *bool `json:"include_descendants,omitempty" jsonschema:"Include descendant work items"`
}
ListInput is the input for listing work items.
type ListOutput ¶
type ListOutput struct {
toolutil.HintableOutput
WorkItems []WorkItemItem `json:"work_items"`
}
ListOutput is the output for listing work items.
func List ¶
func List(ctx context.Context, client *gitlabclient.Client, input ListInput) (ListOutput, error)
List retrieves work items for a project or group.
type UpdateInput ¶
type UpdateInput struct {
FullPath string `json:"full_path" jsonschema:"Full path of the project or group (e.g. my-group/my-project),required"`
IID int64 `json:"iid" jsonschema:"Work item IID,required"`
Title string `json:"title,omitempty" jsonschema:"New title"`
StateEvent string `json:"state_event,omitempty" jsonschema:"State event: CLOSE or REOPEN"`
Description string `json:"description,omitempty" jsonschema:"New description"`
AssigneeIDs []int64 `json:"assignee_ids,omitempty" jsonschema:"Global IDs of assignees (empty array to remove all)"`
MilestoneID *int64 `json:"milestone_id,omitempty" jsonschema:"Global ID of the milestone"`
CRMContactIDs []int64 `json:"crm_contact_ids,omitempty" jsonschema:"CRM contact IDs (empty array to remove all)"`
ParentID *int64 `json:"parent_id,omitempty" jsonschema:"Global ID of the parent work item"`
AddLabelIDs []int64 `json:"add_label_ids,omitempty" jsonschema:"Global IDs of labels to add"`
RemoveLabelIDs []int64 `json:"remove_label_ids,omitempty" jsonschema:"Global IDs of labels to remove"`
StartDate string `json:"start_date,omitempty" jsonschema:"Start date (YYYY-MM-DD)"`
DueDate string `json:"due_date,omitempty" jsonschema:"Due date (YYYY-MM-DD)"`
Weight *int64 `json:"weight,omitempty" jsonschema:"Weight of the work item"`
HealthStatus string `json:"health_status,omitempty" jsonschema:"Health status (onTrack/needsAttention/atRisk)"`
IterationID *int64 `json:"iteration_id,omitempty" jsonschema:"Global ID of the iteration"`
Color string `json:"color,omitempty" jsonschema:"Color hex code (e.g. #fefefe)"`
Status string `json:"status,omitempty" jsonschema:"Work item status: TODO, IN_PROGRESS, DONE, WONT_DO, or DUPLICATE"`
}
UpdateInput is the input for updating a work item.
type WorkItemItem ¶
type WorkItemItem struct {
ID int64 `json:"id"`
IID int64 `json:"iid"`
Type string `json:"type"`
State string `json:"state"`
Status string `json:"status,omitempty"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
WebURL string `json:"web_url,omitempty"`
Author string `json:"author,omitempty"`
Assignees []string `json:"assignees,omitempty"`
Labels []string `json:"labels,omitempty"`
LinkedItems []LinkedItem `json:"linked_items,omitempty"`
Confidential bool `json:"confidential,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
ClosedAt string `json:"closed_at,omitempty"`
}
WorkItemItem is a summary of a work item.