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"]
        }
    ),
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior by detailing what it returns (commit details, code changes, context, author info, statistics), mentions pagination behavior via 'per_page' and 'page' parameters, and specifies filtering capabilities. However, it doesn't explicitly mention rate limits, authentication requirements, or potential side effects, leaving some behavioral aspects uncovered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and usage guidance, but it becomes repetitive with multiple sections (e.g., 'Use cases' and 'Examples' overlap, and the parameter list duplicates schema info). Some sentences, like the second bullet under 'Use cases', could be condensed or removed to improve efficiency without losing value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (9 parameters, no output schema, no annotations), the description is mostly complete. It covers purpose, usage, behavior, and parameters, but lacks details on output format (only lists return categories without structure) and doesn't address potential errors or limitations. It compensates well for the absence of annotations and output schema, but could be more thorough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by listing parameters with brief explanations and providing an example, but it doesn't add significant semantic context or clarify interdependencies (e.g., 'user_id' vs. 'username'). Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('List all commits authored by a specific user') and resources ('commits', 'user'), and distinguishes it from sibling tools by explicitly mentioning 'gitlab_get_user_merge_commits' as an alternative for merge commits. The bolded sentence reinforces the core purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool vs. alternatives, stating 'For merge commits specifically, use 'gitlab_get_user_merge_commits' instead.' It also lists multiple use cases (e.g., code contribution analysis, developer productivity metrics) and includes an example, giving clear context for application.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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