Documentation
¶
Overview ¶
clearguard.go guards the work item update paths that silently discard data: an explicit empty assignee or CRM contact list replaces the current one with nothing.
Package workitems implements MCP tools for GitLab work item operations exposed through issue workflows.
The package wraps GitLab Work items GraphQL fields:
Index ¶
- func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec
- func Delete(ctx context.Context, client *gitlabclient.Client, input DeleteInput) error
- func FormatGetMarkdown(out GetOutput) *mcp.CallToolResult
- func FormatListMarkdown(out ListOutput) *mcp.CallToolResult
- func FormatWorkItemTypeListMarkdown(out WorkItemTypeListOutput) *mcp.CallToolResult
- type ChildItem
- type CreateInput
- type CreateLinkedItems
- type DeleteInput
- type GetInput
- type GetOutput
- type LinkedItem
- type ListInput
- type ListOutput
- type ListWorkItemTypesInput
- type UpdateInput
- type WorkItemItem
- type WorkItemTypeListOutput
- type WorkItemTypeOutput
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 work item actions exposed through gitlab_issue.
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 FormatWorkItemTypeListMarkdown ¶ added in v2.1.2
func FormatWorkItemTypeListMarkdown(out WorkItemTypeListOutput) *mcp.CallToolResult
FormatWorkItemTypeListMarkdown formats a list of work item types as a Markdown table.
Types ¶
type ChildItem ¶ added in v2.5.1
type ChildItem struct {
IID int64 `json:"iid" jsonschema:"Internal ID (IID) of the child work item"`
Path string `json:"path,omitempty" jsonschema:"Namespace full path of the child work item"`
}
ChildItem is a summary reference to a child work item in the hierarchy.
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" tier:"premium" jsonschema:"Weight of the work item"`
HealthStatus string `json:"health_status,omitempty" tier:"ultimate" jsonschema:"Health status (onTrack/needsAttention/atRisk)"`
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"`
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:"work_item_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:"work_item_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 ListWorkItemTypesInput ¶ added in v2.1.2
type ListWorkItemTypesInput struct {
FullPath string `json:"full_path" jsonschema:"Project or group full path (namespace path),required"`
Name string `json:"name,omitempty" jsonschema:"Filter by work item type name"`
OnlyAvailable bool `json:"only_available,omitempty" jsonschema:"Return only available work item types"`
First int64 `json:"first,omitempty" jsonschema:"Number of types to return from the beginning (cursor pagination)"`
After string `json:"after,omitempty" jsonschema:"Cursor for forward pagination"`
Last int64 `json:"last,omitempty" jsonschema:"Number of types to return from the end (backward cursor pagination)"`
Before string `json:"before,omitempty" jsonschema:"Cursor for backward pagination"`
}
ListWorkItemTypesInput defines parameters for listing work item types.
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:"work_item_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 `` /* 192-byte string literal not displayed */
MilestoneID *int64 `json:"milestone_id,omitempty" jsonschema:"Global ID of the milestone"`
CRMContactIDs []int64 `` /* 184-byte string literal not displayed */
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" tier:"premium" jsonschema:"Weight of the work item"`
HealthStatus string `json:"health_status,omitempty" tier:"ultimate" jsonschema:"Health status (onTrack/needsAttention/atRisk)"`
IterationID *int64 `json:"iteration_id,omitempty" tier:"premium" 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"`
// Confirm is declared so the input schema advertises the reserved confirm
// key and strict validation accepts it. Its value is never populated:
// toolutil strips reserved keys before unmarshalling, so the handler reads
// the caller's confirmation from the raw request instead.
Confirm bool `` /* 199-byte string literal not displayed */
}
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"`
Children []ChildItem `json:"children,omitempty" jsonschema:"Child work items in the hierarchy (each with namespace path and IID)"`
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.
type WorkItemTypeListOutput ¶ added in v2.1.2
type WorkItemTypeListOutput struct {
toolutil.HintableOutput
Types []WorkItemTypeOutput `json:"types"`
Pagination toolutil.GraphQLPaginationOutput `json:"pagination"`
}
WorkItemTypeListOutput holds a list of work item types.
func ListWorkItemTypes ¶ added in v2.1.2
func ListWorkItemTypes(ctx context.Context, client *gitlabclient.Client, input ListWorkItemTypesInput) (WorkItemTypeListOutput, error)
ListWorkItemTypes lists work item types (system-defined and custom) for a namespace.
type WorkItemTypeOutput ¶ added in v2.1.2
type WorkItemTypeOutput struct {
ID string `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
}
WorkItemTypeOutput represents a work item type.