Add comprehensive support for comment threads across all GitLab resources
Problem Statement
Currently, the plugin has limited support for replying to comment threads across GitLab resources. While some tools support basic commenting, the ability to reply to specific comments in threads, manage discussions, and maintain thread hierarchy is inconsistent or missing across different resource types.
Affected Resources
The following GitLab resources support threaded discussions but lack comprehensive tooling:
-
Work Items (Issues, Tasks, Epics, etc.) - Partial support via
gitlab_create_workitem_note -
Merge Requests - Has
gitlab_create_mr_notebut limited thread support -
Issues - Has
gitlab_create_issue_notebut no discussion management -
Epics - Has
gitlab_create_epic_notebut no thread functionality - Commits - No comment thread support
- Snippets - No comment support at all
Use Cases
- Reply to specific feedback: "Answer the comment from Joe about the implementation approach"
- Thread-based discussions: "Comment on the thread about performance impact in MR !123"
- Contextual conversations: Maintain organized discussions by keeping related comments together
- Collaborative reviews: Enable team members to discuss specific points without cluttering the main comment stream
- Cross-resource discussions: Consistent threading experience across issues, MRs, epics, and work items
- Resolve discussions: Mark discussion threads as resolved after addressing feedback
Current State Analysis
Existing Tools with Partial Support:
-
gitlab_create_workitem_note- Supportsdiscussion_idparameter -
gitlab_create_mr_note- Creates notes but no thread management -
gitlab_create_issue_note- Creates notes but no thread management -
gitlab_create_epic_note- Creates notes but no thread management -
gitlab_list_mr_discussions- Lists discussions but read-only -
gitlab_list_mr_notes- Lists notes in flat structure -
gitlab_list_issue_notes- Lists notes but no discussion grouping -
gitlab_list_epic_notes- Lists notes but no discussion grouping -
gitlab_get_workitem_notes- Lists notes with pagination
Missing Functionality:
- No way to reply to specific discussion threads for most resources
- No tools to resolve/unresolve discussions
- No discussion management (create, update, delete threads)
- Inconsistent API usage (some use REST, some use GraphQL)
- Limited error handling for thread operations
Proposed Solution
Phase 1: Enhance Existing Comment Tools
Add thread support to existing note creation tools:
-
gitlab_create_mr_note- Adddiscussion_idparameter for thread replies -
gitlab_create_issue_note- Adddiscussion_idparameter for thread replies -
gitlab_create_epic_note- Adddiscussion_idparameter for thread replies -
gitlab_create_workitem_note- Improve existingdiscussion_idhandling - Add validation and error handling for all thread operations
Phase 2: Add Discussion Management Tools
Create new tools for managing discussion threads:
-
gitlab_get_mr_discussion- Get specific discussion thread with all replies -
gitlab_get_issue_discussion- Get specific discussion thread with all replies -
gitlab_get_epic_discussion- Get specific discussion thread with all replies -
gitlab_resolve_discussion- Mark discussion as resolved (MRs, commits) -
gitlab_unresolve_discussion- Reopen resolved discussion -
gitlab_create_discussion- Start new discussion thread with initial comment
Phase 3: Add Missing Comment Support
Add comment functionality for resources that lack it:
-
gitlab_create_commit_note- Comment on commits with thread support -
gitlab_list_commit_discussions- List commit discussion threads -
gitlab_create_snippet_note- Comment on snippets -
gitlab_list_snippet_discussions- List snippet discussions
Phase 4: Unified Discussion API
Create a consistent interface across all resources:
-
gitlab_reply_to_discussion- Universal tool for replying to any discussion -
gitlab_get_discussion- Universal tool for fetching discussion details - Standardize discussion ID formats across REST and GraphQL APIs
- Provide helper functions to convert between ID formats
Phase 5: Testing & Documentation
- Test threaded replies across all resource types
- Verify thread hierarchy is preserved in GitLab UI
- Test discussion resolution workflows
- Create comprehensive documentation with examples for each resource type
- Add troubleshooting guide for common threading issues
Acceptance Criteria
Core Functionality
- Users can reply to specific comments in threads for all supported resources
- Thread hierarchy is preserved and displayed correctly in GitLab UI
- Discussion resolution works for MRs and commits
- Error handling provides clear feedback when thread operations fail
Resource Coverage
- Work Items: Full thread support with discussion management
- Merge Requests: Thread replies and resolution support
- Issues: Thread replies and discussion management
- Epics: Thread replies and discussion management
- Commits: Comment and thread support added
- Snippets: Comment and thread support added
Quality & Documentation
- Consistent API across all resource types
- Comprehensive documentation with examples for each resource
- Tool descriptions clearly explain threading functionality
- Error messages are helpful and actionable
- Performance is acceptable for large discussion threads
Technical Notes
API Considerations
-
Work Items: Use GraphQL API, discussion ID format:
gid://gitlab/Discussion/<id> - Merge Requests: Use REST API, discussion ID is numeric
- Issues: Use REST API, discussion ID is string-based
- Epics: Use REST API (Premium/Ultimate only)
- Commits: Use REST API, supports line-specific comments
- Snippets: Use REST API
Implementation Details
- Need to handle both REST and GraphQL APIs
- Discussion IDs have different formats across APIs
- Some resources require project context, others require group context
- Rate limiting and API quotas must be considered
- Thread depth limits may vary by resource type
Breaking Changes
- Existing tools will have new optional parameters (backward compatible)
- New tools follow consistent naming convention:
gitlab_<action>_<resource>_<object>
Priority Breakdown
High Priority (Most commonly used):
- Merge Request thread replies and resolution
- Issue thread replies
- Work Item thread improvements
Medium Priority:
- Epic thread replies
- Commit comments
- Discussion management tools
Low Priority:
- Snippet comments
- Unified discussion API
Additional Context
This feature would significantly improve collaboration by providing consistent, organized discussion capabilities across all GitLab resources. Users expect threading to work similarly whether they're commenting on an MR, issue, epic, or work item.
Related Issues
- Original scope was limited to work items only
- Expanding to cover all GitLab resources with discussion support
- Aligns with GitLab's unified approach to discussions across the platform