Add discussion thread reply support for MR, issue, and epic notes

Summary

Implements Phase 1 of #3 by adding discussion thread reply support to existing note creation tools for Merge Requests, Issues, and Epics. This enables users to reply to specific comments in discussion threads, maintaining organized conversations across GitLab resources.

What does this MR do?

This MR enhances the GitLab plugin's commenting capabilities by adding thread support to three core resources:

Enhanced Methods

  • createMrNote - Now accepts optional discussion_id to reply to MR discussion threads
  • createIssueNote - Now accepts optional discussion_id to reply to issue discussion threads
  • createEpicNote - Now accepts optional discussion_id to reply to epic discussion threads

New Methods

  • listIssueDiscussions - Fetch all discussion threads for an issue
  • listEpicDiscussions - Fetch all discussion threads for an epic

Tool Updates

  • Updated tool descriptions to document the new threading functionality
  • Added discussion_id parameter documentation explaining how to reply to threads
  • Maintained backward compatibility - discussion_id is optional

How to use

Reply to a discussion thread

// First, get the discussion ID from existing threads
const discussions = await client.listIssueDiscussions('project-path', 123);
const discussionId = discussions[0].id;

// Then reply to that specific thread
await client.createIssueNote('project-path', 123, 'My reply', discussionId);

Create a new top-level comment (existing behavior)

// Omit discussion_id to create a new comment
await client.createIssueNote('project-path', 123, 'New comment');

Testing

  • Ran existing tests to verify backward compatibility
  • Tested thread reply functionality manually
  • Verified changes compile and build correctly

Closes #3 (Phase 1)

Implementation Notes

  • When discussion_id is provided, the API endpoint changes from /notes to /discussions/{discussion_id}/notes
  • This follows GitLab's REST API pattern for adding notes to existing discussion threads
  • Thread hierarchy is preserved in the GitLab UI
  • Backward compatible - existing code without discussion_id continues to work

Next Steps (Future Phases)

  • Phase 2: Add discussion management tools (resolve, unresolve, get specific discussion)
  • Phase 3: Add comment support for commits and snippets
  • Phase 4: Create unified discussion API across all resources
  • Phase 5: Comprehensive testing and documentation
Edited by Vladimir Glafirov

Merge request reports

Loading