Skip to main content
Glama
ffpy

GitLab MCP Code Review

by ffpy

compare_versions

Compare two GitLab commits, branches, or tags to identify differences between versions for code review and change analysis.

Instructions

Compare two commits/branches/tags to see the differences between them.

Args:
    project_id: The GitLab project ID or URL-encoded path
    from_sha: The source commit/branch/tag
    to_sha: The target commit/branch/tag
Returns:
    Dict containing the comparison information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
from_shaYes
to_shaYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'compare_versions' tool. It is registered via the @mcp.tool() decorator. Fetches the GitLab project and uses repository_compare to get differences between two SHAs.
    def compare_versions(ctx: Context, project_id: str, from_sha: str, to_sha: str) -> Dict[str, Any]:
        """
        Compare two commits/branches/tags to see the differences between them.
        
        Args:
            project_id: The GitLab project ID or URL-encoded path
            from_sha: The source commit/branch/tag
            to_sha: The target commit/branch/tag
        Returns:
            Dict containing the comparison information
        """
        gl = ctx.request_context.lifespan_context
        project = gl.projects.get(project_id)
        
        try:
            result = project.repository_compare(from_sha, to_sha)
        except Exception as e:
            logger.error(f"Failed to compare {from_sha} and {to_sha}: {e}")
            result = {}
        
        return result
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that the tool 'compare[s] two commits/branches/tags' and returns a 'Dict containing the comparison information,' but fails to describe critical behaviors: whether this is a read-only operation, potential rate limits, authentication needs, error conditions, or what specific information is included in the comparison (e.g., diffs, statistics). For a tool with no annotation coverage, this leaves significant gaps.

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 appropriately sized and well-structured: a clear purpose statement followed by a formatted list of arguments and returns. Each sentence earns its place by conveying essential information without redundancy. It could be slightly more front-loaded by emphasizing the tool's core function earlier, but overall it's efficient.

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's moderate complexity (3 parameters, no annotations, but with an output schema), the description is partially complete. It covers the purpose and parameters adequately, and the presence of an output schema means it doesn't need to detail return values. However, it lacks behavioral context (e.g., safety, performance) and usage guidelines, which are important for an agent to invoke it correctly in a GitLab environment with sibling tools.

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 value by explaining each parameter: 'project_id: The GitLab project ID or URL-encoded path,' 'from_sha: The source commit/branch/tag,' and 'to_sha: The target commit/branch/tag.' This clarifies the semantics beyond just the parameter names. However, it doesn't provide format examples, validation rules, or constraints, keeping it at a baseline level.

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: 'Compare two commits/branches/tags to see the differences between them.' This specifies the verb ('compare') and resources ('commits/branches/tags'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'fetch_merge_request' or 'get_project_merge_requests', which might also involve version-related operations.

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 prerequisites, context for comparison (e.g., code reviews, debugging), or exclusions. Given sibling tools like 'fetch_merge_request' that might retrieve similar data, the lack of differentiation leaves the agent without clear usage instructions.

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/ffpy/gitlab-mcp-code-review'

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