Skip to main content
Glama

get_merge_request_commits

Retrieve all commits included in a GitLab merge request to review code changes and track development history for specific projects and MRs.

Instructions

取得 Merge Request 包含的 commits

Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
mr_iidYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'get_merge_request_commits', which calls the GitLab client's method.
    @mcp.tool()
    def get_merge_request_commits(project_id: int | str, mr_iid: int) -> str:
        """取得 Merge Request 包含的 commits
    
        Args:
            project_id: 專案 ID 或路徑
            mr_iid: MR 的 IID
        """
        try:
            client = get_client()
            commits = client.get_merge_request_commits(project_id, mr_iid)
    
            if not commits:
                return "此 MR 沒有 commits"
    
            lines = [f"MR !{mr_iid} 包含 {len(commits)} 個 commits:\n"]
            for c in commits:
                lines.append(
                    f"- {c.get('short_id', 'N/A')} {c.get('title', 'N/A')}"
                    f"\n  作者: {c.get('author_name', 'N/A')} | {c.get('authored_date', 'N/A')}"
                )
            return "\n".join(lines)
        except GitLabAPIError as e:
            return f"取得 MR commits 失敗: {str(e)}"
  • The actual implementation of get_merge_request_commits which communicates with the GitLab API.
    def get_merge_request_commits(
        self, project_id: int | str, mr_iid: int
    ) -> list[dict]:
        """GET /projects/:id/merge_requests/:iid/commits"""
        pid = self._resolve_project_id(project_id)
        return self._get_json(f"/projects/{pid}/merge_requests/{mr_iid}/commits")
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It only states what the tool does ('取得 Merge Request 包含的 commits') without describing return format, pagination, error conditions, authentication needs, or rate limits. For a read operation with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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

Conciseness4/5

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

The description is concise and front-loaded: the first sentence states the purpose clearly, followed by a brief parameter list. There's no wasted text, and the structure (purpose then args) is logical. It could be slightly more polished but earns high marks for efficiency.

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

Completeness3/5

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

Given the tool has an output schema (which handles return values), no annotations, and simple parameters, the description is minimally adequate. It covers the basic purpose and parameters but lacks behavioral context (e.g., what the commits output looks like or error handling). For a read tool with output schema, it's passable but not comprehensive.

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 0%, so the schema provides no parameter descriptions. The description adds minimal semantics: it explains 'project_id' as '專案 ID 或路徑' (project ID or path) and 'mr_iid' as 'MR 的 IID' (MR's IID), which clarifies data types beyond the schema. However, it doesn't detail format constraints (e.g., path syntax) or examples, leaving room for improvement given the low coverage.

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

Purpose4/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: '取得 Merge Request 包含的 commits' (Get commits included in a Merge Request). It specifies the verb '取得' (get) and resource 'commits' with context 'Merge Request'. However, it doesn't explicitly differentiate from sibling tools like 'get_commit' or 'list_commits', which reduces it from a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_merge_request' (which might return commit info) or 'list_commits' (which lists commits more broadly), nor does it specify prerequisites or exclusions. The only context is implicit from the tool name and parameters.

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/snowild/gitlab-mcp'

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