gitlab_get_user_merge_commits
Retrieve merge commits performed by a specific user to track integrated contributions and analyze merge activity for release management.
Instructions
List merge commits where a specific user performed the merge.
Shows commits where the user merged branches (not necessarily the code author). Use this tool to see what merges a user has performed, useful for release management.
Examples:
Release management: get_user_merge_commits(user_id=123)
Merge activity tracking
Integration oversight
For all commits authored by user, use 'gitlab_get_user_commits' instead.
Find all commits that originated from merge requests created by the specified user, tracking their integrated contributions.
Returns merge-related commits with:
Commit details: SHA, message, merge info
MR context: original MR, review process
Integration info: target branch, merge strategy
Quality metrics: review feedback, CI results
Timeline: development to integration time
Use cases:
Track integrated contributions
Measure code review effectiveness
Analyze development workflows
Quality assurance reporting
Parameters:
user_id: Numeric user ID
username: Username string (use either user_id or username)
project_id: Optional project scope filter
target_branch: Filter by target branch (e.g., main)
since: MRs merged after date (YYYY-MM-DD)
until: MRs merged before date (YYYY-MM-DD)
include_review_metrics: Include review statistics
per_page: Results per page (default: 20)
page: Page number (default: 1)
Example: Get merged contributions to main branch
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | Username string | |
| project_id | No | Optional project scope filter | |
| since | No | Commits after date (YYYY-MM-DD) | |
| until | No | Commits before date (YYYY-MM-DD) | |
| per_page | No | Number of results per page Type: integer Range: 1-100 Default: 20 Example: 50 (for faster browsing) Tip: Use smaller values (10-20) for detailed operations, larger (50-100) for listing | |
| page | No | Page number for pagination Type: integer Range: ≥1 Default: 1 Example: 3 (to get the third page of results) Note: Use with per_page to navigate large result sets |
Implementation Reference
- src/mcp_gitlab/tool_handlers.py:858-878 (handler)The primary handler function that implements the gitlab_get_user_merge_commits tool. It validates input arguments (requiring username), extracts optional parameters, and delegates to GitLabClient.get_user_merge_commits() for the actual API call.def handle_get_user_merge_commits(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]: """Handle getting user's merge commits""" username = get_argument(arguments, "username") if not username: raise ValueError("username is required") project_id = get_argument(arguments, "project_id") since = get_argument(arguments, "since") until = get_argument(arguments, "until") per_page = get_argument(arguments, "per_page", DEFAULT_PAGE_SIZE) page = get_argument(arguments, "page", 1) return client.get_user_merge_commits( username=username, project_id=project_id, since=since, until=until, per_page=per_page, page=page )
- Pydantic/MCP schema definition for the gitlab_get_user_merge_commits tool, including input parameters, types, descriptions, defaults, and required fields.types.Tool( name=TOOL_GET_USER_MERGE_COMMITS, description=desc.DESC_GET_USER_MERGE_COMMITS, inputSchema={ "type": "object", "properties": { "username": {"type": "string", "description": "Username string"}, "project_id": {"type": "string", "description": "Optional project scope filter"}, "since": {"type": "string", "description": "Merges after date (YYYY-MM-DD)"}, "until": {"type": "string", "description": "Merges before date (YYYY-MM-DD)"}, "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE}, "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1} }, "required": ["username"] }
- src/mcp_gitlab/tool_handlers.py:1087-1089 (registration)Registration of the handler function in the central TOOL_HANDLERS dictionary used by server.call_tool() to dispatch tool calls to the correct handler.TOOL_GET_USER_COMMITS: handle_get_user_commits, TOOL_GET_USER_MERGE_COMMITS: handle_get_user_merge_commits, TOOL_GET_USER_CODE_CHANGES_SUMMARY: handle_get_user_code_changes_summary,
- Improved tool description and suggested renaming for better LLM usability and reduced ambiguity."gitlab_get_user_merge_commits": { "new_name": "gitlab_list_merge_commits_by_user", "description": """List merge commits where a specific user performed the merge. Shows commits where the user merged branches (not necessarily the code author). **Use this tool to see what merges a user has performed, useful for release management.** Examples: - Release management: list_merge_commits_by_user(user_id=123) - Merge activity tracking - Integration oversight For all commits authored by user, use 'list_commits_authored_by_user' instead.""" }
- src/mcp_gitlab/constants.py:266-878 (registration)Constant definition for the tool name string, used consistently across handler registration, schema, and server.TOOL_GET_USER_MERGE_COMMITS = "gitlab_get_user_merge_commits" TOOL_GET_USER_CODE_CHANGES_SUMMARY = "gitlab_get_user_code_changes_summary" TOOL_GET_USER_SNIPPETS = "gitlab_get_user_snippets" # User's Comments & Discussions tools TOOL_GET_USER_ISSUE_COMMENTS = "gitlab_get_user_issue_comments" TOOL_GET_USER_MR_COMMENTS = "gitlab_get_user_mr_comments" TOOL_GET_USER_DISCUSSION_THREADS = "gitlab_get_user_discussion_threads" TOOL_GET_USER_RESOLVED_THREADS = "gitlab_get_user_resolved_threads" # Me / Inbox tools TOOL_GET_MY_OPEN_MRS = "gitlab_get_my_open_mrs" TOOL_GET_MRS_AWAITING_MY_REVIEW = "gitlab_get_mrs_awaiting_my_review" TOOL_GET_MY_OPEN_ISSUES = "gitlab_get_my_open_issues" TOOL_GET_MY_TODOS_DIGEST = "gitlab_get_my_todos_digest" # MR Triage & Review Flow tools TOOL_FIND_REVIEW_READY_MRS = "gitlab_find_review_ready_mrs" TOOL_FIND_STALE_MRS = "gitlab_find_stale_mrs" TOOL_FIND_MERGE_BLOCKERS = "gitlab_find_merge_blockers" TOOL_AUTOFIX_MR_METADATA = "gitlab_autofix_mr_metadata" TOOL_ASSIGN_REVIEWER_ROTATION = "gitlab_assign_reviewer_rotation" TOOL_AUTO_MERGE_WHEN_GREEN = "gitlab_auto_merge_when_green" TOOL_RESOLVE_DISCUSSIONS_AND_MERGE = "gitlab_resolve_discussions_and_merge" # Issue ↔ Branch ↔ MR Workflow tools TOOL_BOOTSTRAP_ISSUE_BRANCH_MR = "gitlab_bootstrap_issue_branch_mr" TOOL_LINK_ISSUE_TO_EXISTING_MR = "gitlab_link_issue_to_existing_mr" TOOL_BULK_CLOSE_FIXED_ISSUES = "gitlab_bulk_close_fixed_issues" # Release & Backports tools TOOL_PREPARE_RELEASE_NOTES = "gitlab_prepare_release_notes" TOOL_TAG_AND_RELEASE_FROM_MILESTONE = "gitlab_tag_and_release_from_milestone" TOOL_BACKPORT_MR_TO_BRANCHES = "gitlab_backport_mr_to_branches" TOOL_HOTFIX_FROM_ISSUE = "gitlab_hotfix_from_issue" # CI/CD & Quality tools TOOL_RERUN_FAILED_PIPELINE_SEGMENT = "gitlab_rerun_failed_pipeline_segment" TOOL_FLAKY_TEST_DETECTOR = "gitlab_flaky_test_detector" TOOL_PIPELINE_RED_ALERTS = "gitlab_pipeline_red_alerts" TOOL_DOWNLOAD_LATEST_ARTIFACTS = "gitlab_download_latest_artifacts" TOOL_COMPARE_PIPELINE_DURATIONS = "gitlab_compare_pipeline_durations" # Code & Security tools TOOL_SMART_CODE_SEARCH = "gitlab_smart_code_search" TOOL_FIND_SUSPECT_COMMITS_SINCE_FAILURE = "gitlab_find_suspect_commits_since_failure" TOOL_DEPENDENCY_UPDATE_BATCH = "gitlab_dependency_update_batch" TOOL_SECURITY_FINDINGS_DIGEST = "gitlab_security_findings_digest" # Project Hygiene tools TOOL_PRUNE_STALE_BRANCHES = "gitlab_prune_stale_branches" TOOL_SYNC_LABELS_POLICY = "gitlab_sync_labels_policy" TOOL_AUTO_ARCHIVE_OLD_ISSUES = "gitlab_auto_archive_old_issues" TOOL_ENFORCE_MR_RULESET = "gitlab_enforce_mr_ruleset" # Cross-Project Views tools TOOL_GROUP_MR_RISK_RADAR = "gitlab_group_mr_risk_radar" TOOL_GROUP_ACTIVITY_SUMMARY = "gitlab_group_activity_summary" TOOL_GROUP_OPEN_RELEASE_TRAINS = "gitlab_group_open_release_trains" # Ownership & Notifications tools TOOL_OWNER_MAP_FROM_CODEOWNERS = "gitlab_owner_map_from_codeowners" TOOL_NOTIFY_OWNERS_ON_DIRECTORY_CHANGES = "gitlab_notify_owners_on_directory_changes" # Governance & Compliance tools TOOL_MR_TEMPLATE_ENFORCER = "gitlab_mr_template_enforcer" TOOL_LICENCE_COMPLIANCE_AUDIT = "gitlab_licence_compliance_audit"