Add resolve_discussion method to save_note MCP tool
What does this MR do and why?
Adds a resolve_discussion method to the save_note MCP tool so agents can resolve or unresolve discussion threads on work items (issues, tasks, epics). Until now, an agent could read and reply to a work item discussion through MCP but had no way to close the loop once it had handled the thread.
The change mirrors the resolve_discussion method of save_merge_request_review:
- New optional
methodparameter (create_note,reply_discussion,resolve_discussion). When omitted, the tool behaves as before, so thecreate_merge_request_note/create_workitem_notealiases keep working. - New
resolvedboolean parameter. discussion_idnow accepts a bare discussion ID as well as a global ID.bodyis no longer required at the schema level; the tool rejects note methods without a body.- Reuses the existing
discussionToggleResolveoperation fromapp/graphql/queries/mcp/merge_requests/discussion_toggle_resolve.mutation.graphql, which is noteable-agnostic. Authorization stays in the mutation (Discussion#can_resolve?).
Output for resolve_discussion:
{ "method": "resolve_discussion", "discussion_id": "gid://gitlab/Discussion/<id>", "resolved": true, "web_url": "..." }References
- Resolves #617756 (closed)
- Parent epic: gitlab-org#23301
Screenshots or screen recordings
Not applicable, no UI changes.
How to set up and validate locally
-
Create an issue in a project where you are a Developer and start a discussion thread on it.
-
In a Rails console, grab the discussion ID:
issue = Project.find_by_full_path('<group>/<project>').issues.last discussion_id = issue.notes.last.discussion_id -
Call the tool as that user:
service = Mcp::Tools::Notes::SaveNoteService.new(name: 'save_note') service.set_cred(current_user: User.find_by_username('<you>')) service.execute(params: { arguments: { project_id: '<group>/<project>', work_item_iid: issue.iid, method: 'resolve_discussion', discussion_id: discussion_id, resolved: true } }) -
Reload the issue page: the thread shows as resolved. Call again with
resolved: falseto unresolve it. -
Confirm the previous behavior still works by calling without
methodand with abody.
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.