Skip to main content
Glama

gitlab_get_user_commits

Retrieve commits authored by a specific user to track code contributions, analyze development activity, and prepare for code reviews with filtering by project, branch, or time period.

Instructions

List all commits authored by a specific user across projects or within a project.

Shows commits where the user is the author (wrote the code). Use this tool to see what code changes a user has authored.

Examples:

  • Code contribution analysis: get_user_commits(user_id=123)

  • Developer productivity metrics

  • Code review preparation

For merge commits specifically, use 'gitlab_get_user_merge_commits' instead.

Retrieve all commits authored by the specified user with flexible filtering by time period, branch, or project scope.

Returns commit information with:

  • Commit details: SHA, message, timestamp

  • Code changes: files modified, additions, deletions

  • Context: branch, project, merge request associations

  • Author info: email, committer details

  • Statistics: impact, complexity metrics

Use cases:

  • Code contribution tracking

  • Development velocity analysis

  • Code review preparation

  • Performance evaluations

Parameters:

  • user_id: Numeric user ID

  • username: Username string (use either user_id or username)

  • project_id: Optional project scope filter

  • branch: Filter by specific branch

  • since: Commits after date (YYYY-MM-DD)

  • until: Commits before date (YYYY-MM-DD)

  • include_stats: Include file change statistics

  • per_page: Results per page (default: 20)

  • page: Page number (default: 1)

Example: Get user commits from main branch last month

{
  "username": "johndoe", 
  "branch": "main",
  "since": "2024-01-01",
  "until": "2024-01-31",
  "include_stats": true
}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idNoNumeric user ID
usernameNoUsername string
project_idNoOptional project scope filter
branchNoFilter by specific branch
sinceNoCommits after date (YYYY-MM-DD)
untilNoCommits before date (YYYY-MM-DD)
include_statsNoInclude file change statistics
per_pageNoNumber 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
pageNoPage 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

  • The main handler function for the gitlab_get_user_commits tool. Extracts parameters from arguments and calls GitLabClient.get_user_commits() to retrieve commits authored by the specified user.
    def handle_get_user_commits(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle getting user's commits"""
        user_id = get_argument(arguments, "user_id")
        username = get_argument(arguments, "username")
        project_id = get_argument(arguments, "project_id")
        branch = get_argument(arguments, "branch")
        since = get_argument(arguments, "since")
        until = get_argument(arguments, "until")
        include_stats = get_argument(arguments, "include_stats", False)
        per_page = get_argument(arguments, "per_page", DEFAULT_PAGE_SIZE)
        page = get_argument(arguments, "page", 1)
        
        return client.get_user_commits(
            user_id=user_id,
            username=username,
            project_id=project_id,
            branch=branch,
            since=since,
            until=until,
            include_stats=include_stats,
            per_page=per_page,
            page=page
        )
  • Tool schema definition in server.py list_tools() method, specifying input parameters and validation for the gitlab_get_user_commits tool.
        name=TOOL_GET_USER_COMMITS,
        description=desc.DESC_GET_USER_COMMITS,
        inputSchema={
            "type": "object",
            "properties": {
                "user_id": {"type": "string", "description": "Numeric user ID"},
                "username": {"type": "string", "description": "Username string"},
                "project_id": {"type": "string", "description": "Optional project scope filter"},
                "branch": {"type": "string", "description": "Filter by specific branch"},
                "since": {"type": "string", "description": "Commits after date (YYYY-MM-DD)"},
                "until": {"type": "string", "description": "Commits before date (YYYY-MM-DD)"},
                "include_stats": {"type": "boolean", "description": "Include file change statistics", "default": False},
                "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}
            }
        }
    ),
  • Registration mapping in TOOL_HANDLERS dictionary that associates the tool name TOOL_GET_USER_COMMITS with its handler function. Used in server.py handle_call_tool().
        # User's Code & Commits handlers  
        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,
        TOOL_GET_USER_SNIPPETS: handle_get_user_snippets,
        
        # User's Comments & Discussions handlers
        TOOL_GET_USER_ISSUE_COMMENTS: handle_get_user_issue_comments,
        TOOL_GET_USER_MR_COMMENTS: handle_get_user_mr_comments,
        TOOL_GET_USER_DISCUSSION_THREADS: handle_get_user_discussion_threads,
        TOOL_GET_USER_RESOLVED_THREADS: handle_get_user_resolved_threads,
    }
  • Constant definition for the tool name string, used consistently across schema definitions and handler registrations.
    TOOL_GET_USER_COMMITS = "gitlab_get_user_commits"
  • Alternative/backup schema definition in tool_definitions.py (potentially unused), matching the active schema in server.py.
        name=TOOL_GET_USER_COMMITS,
        description=desc.DESC_GET_USER_COMMITS,
        inputSchema={
            "type": "object",
            "properties": {
                "username": {"type": "string", "description": "Username string"},
                "project_id": {"type": "string", "description": "Optional project scope filter"},
                "since": {"type": "string", "description": "Commits after date (YYYY-MM-DD)"},
                "until": {"type": "string", "description": "Commits 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"]
        }
    ),

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Vijay-Duke/mcp-gitlab'

If you have feedback or need assistance with the MCP directory API, please join our Discord server