Skip to content

feat: add work items toolset via GraphQL API#362

Open
DarkByteZero wants to merge 8 commits intozereight:mainfrom
DarkByteZero:feat/work-item-support
Open

feat: add work items toolset via GraphQL API#362
DarkByteZero wants to merge 8 commits intozereight:mainfrom
DarkByteZero:feat/work-item-support

Conversation

@DarkByteZero
Copy link

@DarkByteZero DarkByteZero commented Mar 10, 2026

Summary

GitLab standardizes planning objects around Work Items. The legacy Issues REST API remains supported, but it does not cover all modern work item capabilities. In particular, richer work item features such as configurable statuses and custom fields are exposed through the Work Item APIs, making GraphQL the more complete integration surface today.

This PR adds a new workitems toolset (opt-in via GITLAB_TOOLSETS) with 10 tools that cover the full work item lifecycle using the GraphQL API:

  • get_work_item - Fetch a single work item with all widget data (status, hierarchy, labels, health status, dates, milestone, iteration, progress, linked items with details, time tracking, related MRs/branches, custom fields, weight with rollup, color, confidential, author, timestamps). Output is optimized to omit null/empty values.
  • list_work_items - List and filter work items with pagination. Returns lean per-item summaries.
  • create_work_item - Create any work item type with support for labels, assignees, weight, parent hierarchy, health status, start/due dates, milestone, iteration, and confidentiality.
  • update_work_item - Consolidated update tool that handles all fields in one call: title, description, labels (set/add/remove), assignees, state, weight, status (by ID), health status, dates, milestone, iteration, confidentiality, parent (set/remove), children (add/remove), linked items (related/blocks/blocked_by), and custom fields (text/number/select/date).
  • convert_work_item_type - Convert between work item types.
  • move_work_item - Move a work item to a different project.
  • list_work_item_statuses - Discover available statuses, supported conversion types, and allowed child/parent types per work item type.
  • list_custom_field_definitions - Discover available custom field definitions (name, type, ID) for a work item type.
  • list_work_item_notes - List threaded discussions/notes on a work item with pagination and sort.
  • create_work_item_note - Add a note/comment to a work item. Supports Markdown, internal notes, and threaded replies.

All 9 GitLab work item types are supported: issue, task, incident, test_case, epic, key_result, objective, requirement, ticket.

Additional changes

  • Fixed createIssue where issue_type and weight fields were silently dropped
  • Added reusable GraphQL infrastructure: executeGraphQL, resolveWorkItemGID, resolveWorkItemTypeGID, resolveProjectPath
  • The toolset is opt-in (isDefault: false) so it does not affect existing users

Test plan

  • Verified all GraphQL queries/mutations work against a live GitLab Premium instance
  • Tested get, list, create, update, convert, move, notes tools
  • Tested list_work_item_statuses returns statuses, conversion types, and hierarchy constraints
  • Tested list_custom_field_definitions returns available fields
  • Verified output is lean (no null spam, labels as strings, assignees as usernames)
  • Build passes with no TypeScript errors

New `workitems` toolset with 6 tools replacing REST-based issue operations:

- get_work_item: fetch single item with all widgets (status, hierarchy, labels,
  health status, dates, milestone, linked items, time tracking, development/MRs,
  custom fields) — output optimized, omits null/empty values
- list_work_items: list/filter with pagination, returns lean summary per item
- create_work_item: create any type with labels, assignees, weight, parent,
  health status, dates, milestone, confidential
- update_work_item: consolidated update for all fields including status (by ID),
  parent/children hierarchy, linked items (related/blocks/blocked_by),
  custom fields, health status, dates, milestone
- convert_work_item_type: type conversion via workItemConvert mutation
- list_work_item_statuses: discover available statuses per type

Supports all 9 work item types: issue, task, incident, test_case, epic,
key_result, objective, requirement, ticket.

Also fixes:
- createIssue now passes all fields via spread (issue_type, weight were dropped)
- Adds reusable GraphQL infrastructure (executeGraphQL, resolveWorkItemGID,
  resolveWorkItemTypeGID, resolveProjectPath)
@DarkByteZero
Copy link
Author

Later issues tools could be fully replaced by new WorkItem API actually.

- Add list_custom_field_definitions tool to discover available custom fields per work item type
- Enhance getWorkItem with iteration, progress, color, linked items details, weight rollup, confidential, author, createdAt/closedAt
- Enhance list_work_item_statuses to return supported conversion types and allowed child/parent types
- Add iteration_id support to create_work_item and update_work_item
- Expand all type enums to include all 9 work item types
- Remove tier annotations from descriptions
- Add move_work_item tool using GraphQL issueMove mutation
- Remove redundant "Uses GitLab GraphQL API" from tool descriptions
…ools

- list_work_item_notes: threaded discussions with pagination and sort
- create_work_item_note: supports markdown, internal notes, and threaded replies
- Replace separate REST-based resolveLabelIds and resolveUserIds with
  single resolveNamesToIds GraphQL call (labels + users in one request)
- Fix assignees: use assigneeIds (UserID GIDs) instead of assigneeUsernames
  which isn't supported by WorkItemWidgetAssigneesInput
- Fix description type in update: String -> String! (non-null required)
- Fix linkType: String! -> WorkItemRelatedLinkType! for linked items
- Remove misleading 'labels' field from UpdateWorkItemSchema (only
  add_labels/remove_labels remain)
…inked items

Add namespace.fullPath to children and linkedItems GraphQL queries so
work items from other projects include their project path in the response.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant