Loading
Add approvals facet to the get_merge_request MCP tool
What does this MR do and why?
Adds approvals to the include enum of the existing get_merge_request MCP server tool. It does not add a new tool. This replaces !250827 (closed), which proposed a standalone get_merge_request_approvals tool.
How to test locally
-
Call the tool in
rails runneron a GDK with an Ultimate license, against an open merge request you can read. A call with noincludereturns no approval fields. A call withinclude: ['approvals']returns the five fields.user = User.find_by(username: 'root') mr = MergeRequest.where(state_id: 1).last Mcp::Tools::MergeRequests::GetMergeRequestTool.new( current_user: user, params: { project_id: mr.target_project.id.to_s, merge_request_iid: mr.iid, include: ['approvals'] } ).execute -
Verified output on an Ultimate GDK, for a merge request with one approval rule that needs 2 approvals and has 1 approval recorded:
approved=true approvalsRequired=2 approvalsLeft=1 approvedBy.nodes=[{id, username, name} for the one approver] approvalState.rules=[{name, type: REGULAR, approvalsRequired: 2, approved: true, eligibleApprovers, approvedBy}]
Without a Premium or Ultimate license, the same call returns approved and approvedBy, and the other three fields come back empty.
Closes #596590 (closed)
Edited by Amr Taha