Implements graphql mcp create work item note mutation
What does this MR do and why?
AI Summary:
This MR implements a GraphQL-based MCP (Model Context Protocol) mutation for creating notes (comments) on work items. The implementation provides a flexible API that supports both project and group work items, with multiple identification methods.
Key features:
- Flexible work item identification: Supports identification via URL, project_id/group_id with work_item_iid, or direct GitLab URLs
- Note creation capabilities: Creates notes with optional parameters including internal flag and discussion threading
-
Quick action validation: Prevents quick actions (commands starting with
/) in note bodies to maintain API consistency - Comprehensive access control: Validates user permissions for both parent resources (projects/groups) and work items
- Full test coverage: Includes extensive unit and integration tests for all components
Architecture:
The implementation follows a modular design with reusable concerns:
-
Constants- Defines work item types and URL patterns -
ResourceFinder- Handles resource lookup and access control -
UrlParser- Parses and resolves GitLab URLs -
BaseTool- Provides shared functionality for work item tools -
CreateWorkItemNoteTool- Implements the GraphQL mutation -
GraphqlCreateWorkItemNoteService- Service layer for the MCP tool
Supported parameters:
- Work item identification:
url,project_id/group_id+work_item_iid - Note content:
body(required, max 1,048,576 characters) - Optional:
internal(boolean),discussion_id(for threading replies)
References
- Issue: #581890 (closed)
- Existing DAP tool implementation
- Base implementation: Implement GraphQL MCP integration (!211553 - merged)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
You can test create_workitem_note tool using MCP inspector.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Naman Jagdish Gala