Skip to main content
Glama

gitlab_list_commits

View and filter repository commit history by date, branch, or file path to track changes and find specific modifications.

Instructions

List repository commits Returns: Array of commits with details Use when: Viewing history, finding specific changes Filtering: By date range, file path, branch Pagination: Yes (default 20 per page)

Example response: [{ "id": "e83c5163316f89bfbde7d9ab23ca2e25604af290", "short_id": "e83c516", "title": "Fix critical bug", "author_name": "John Doe", "committed_date": "2024-01-15T14:30:00Z", "message": "Fix critical bug\n\nDetailed explanation..." }]

Related tools:

  • gitlab_get_commit: Full commit details

  • gitlab_get_commit_diff: See changes

  • gitlab_search_in_project: Search commits

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoProject identifier (auto-detected if not provided) Type: integer OR string Format: numeric ID or 'namespace/project' Optional: Yes - auto-detects from current git repository Examples: - 12345 (numeric ID) - 'gitlab-org/gitlab' (namespace/project path) - 'my-group/my-subgroup/my-project' (nested groups) Note: If in a git repo with GitLab remote, this can be omitted
ref_nameNoGit reference Type: string Format: branch name, tag name, or tag name Optional: Yes - defaults to project's default branch Examples: - 'main' (branch) - 'feature/new-login' (feature branch) - 'v2.0.0' (tag) - 'abc1234' (short tag name) - 'e83c5163316f89bfbde7d9ab23ca2e25604af290' (full SHA) Default: Project's default branch (usually 'main' or 'master')
sinceNoStart date for filtering Type: string Format: ISO 8601 (YYYY-MM-DD or full timestamp) Optional: Yes Examples: - '2024-01-01' (from start of year) - '2024-01-01T00:00:00Z' (with time, UTC) - '2024-01-01T09:00:00+02:00' (with timezone) Timezone: Defaults to UTC if not specified Use case: Filter commits/events after a specific date
untilNoEnd date for filtering Type: string Format: ISO 8601 (YYYY-MM-DD or full timestamp) Optional: Yes Examples: - '2024-12-31' (until end of year) - '2024-12-31T23:59:59Z' (end of day, UTC) - '2024-12-31T17:00:00-05:00' (with timezone) Timezone: Defaults to UTC if not specified Use case: Filter commits/events before a specific date
pathNoFile path filter for commits Type: string Format: Relative file path Optional: Yes Examples: - 'src/main.py' (commits touching this file) - 'docs/' (commits in docs directory) - 'package.json' (dependency updates) Use case: Track history of specific files
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

  • Handler function that processes arguments and calls GitLabClient.get_commits to list commits for a project.
    def handle_get_commits(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle getting commits"""
        project_id = require_project_id(client, arguments)
        ref_name = get_argument(arguments, "ref_name")
        since = get_argument(arguments, "since")
        until = get_argument(arguments, "until")
        path = get_argument(arguments, "path")
        per_page = get_argument(arguments, "per_page", DEFAULT_PAGE_SIZE)
        page = get_argument(arguments, "page", 1)
        
        return client.get_commits(project_id, ref_name, since, until, path, per_page, page)
  • Maps the tool name 'gitlab_list_commits' to its handler function in TOOL_HANDLERS dictionary, used by server.call_tool.
    TOOL_LIST_COMMITS: handle_get_commits,
    TOOL_LIST_REPOSITORY_TREE: handle_get_repository_tree,
  • Pydantic/MCP schema definition for gitlab_list_commits tool inputs.
        name=TOOL_LIST_COMMITS,
        description=desc.DESC_LIST_COMMITS,
        inputSchema={
            "type": "object",
            "properties": {
                "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                "ref_name": {"type": "string", "description": desc.DESC_REF.replace("commit SHA", "tag name")},
                "since": {"type": "string", "description": desc.DESC_DATE_SINCE},
                "until": {"type": "string", "description": desc.DESC_DATE_UNTIL},
                "path": {"type": "string", "description": desc.DESC_PATH_FILTER},
                "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}
            }
        }
    ),
  • Explicit registration of gitlab_list_commits tool in MCP server's @list_tools handler.
        name=TOOL_LIST_COMMITS,
        description=desc.DESC_LIST_COMMITS,
        inputSchema={
            "type": "object",
            "properties": {
                "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                "ref_name": {"type": "string", "description": desc.DESC_REF.replace("commit SHA", "tag name")},
                "since": {"type": "string", "description": desc.DESC_DATE_SINCE},
                "until": {"type": "string", "description": desc.DESC_DATE_UNTIL},
                "path": {"type": "string", "description": desc.DESC_PATH_FILTER},
                "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}
            }
        }
    ),
  • Constant definition for the tool name 'gitlab_list_commits'.
    TOOL_LIST_COMMITS = "gitlab_list_commits"
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 and does well by disclosing key behavioral traits: it mentions pagination ('Yes (default 20 per page)'), filtering capabilities ('By date range, file path, branch'), and provides an example response structure. However, it doesn't cover aspects like rate limits or authentication needs, which could be relevant for a read operation.

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

Conciseness5/5

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

The description is well-structured and front-loaded with key information (purpose, returns, usage, filtering, pagination), followed by an example and related tools. Every sentence adds value without redundancy, making it efficient and easy to scan.

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 (7 parameters, no output schema, no annotations), the description is quite complete: it covers purpose, usage, filtering, pagination, example response, and related tools. However, it could be more comprehensive by explicitly mentioning that it's a read-only operation or any error conditions, though the lack of annotations and output schema is partially mitigated by the detailed schema.

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?

The schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by briefly mentioning filtering ('Filtering: By date range, file path, branch') and pagination, but doesn't provide additional syntax or format details. This meets the baseline for high schema coverage.

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 a specific verb ('List') and resource ('repository commits'), and it distinguishes itself from siblings by mentioning related tools like gitlab_get_commit and gitlab_search_in_project, which have different functions (detailed view vs. search).

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 explicitly provides usage guidance with 'Use when: Viewing history, finding specific changes', and it lists related tools with their purposes (e.g., gitlab_get_commit for full details, gitlab_search_in_project for search), clearly indicating when to use this tool versus alternatives.

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