Skip to main content
Glama

gitlab_compare_branches

Analyze differences between branches, tags, or commits in GitLab projects by specifying the project ID and comparison references to identify changes efficiently.

Instructions

Compare branches, tags or commits

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromYesThe commit SHA or branch name to compare from
project_idYesThe ID or URL-encoded path of the project
toYesThe commit SHA or branch name to compare to

Implementation Reference

  • The core handler function for gitlab_compare_branches that validates parameters and calls the GitLab API to compare two branches/tags/commits in a project.
    export const compareBranches: ToolHandler = async (params, context) => {
      const { project_id, from, to } = params.arguments || {};
      if (!project_id || !from || !to) {
        throw new McpError(ErrorCode.InvalidParams, 'project_id, from, and to are required');
      }
      
      const response = await context.axiosInstance.get(
        `/projects/${encodeURIComponent(String(project_id))}/repository/compare`,
        { params: { from, to } }
      );
      return formatResponse(response.data);
    };
  • JSON schema defining the input parameters for the gitlab_compare_branches tool.
    {
      name: 'gitlab_compare_branches',
      description: 'Compare branches, tags or commits',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'The ID or URL-encoded path of the project'
          },
          from: {
            type: 'string',
            description: 'The commit SHA or branch name to compare from'
          },
          to: {
            type: 'string',
            description: 'The commit SHA or branch name to compare to'
          }
        },
        required: ['project_id', 'from', 'to']
      }
    },
  • Maps the tool name 'gitlab_compare_branches' to its handler function repoHandlers.compareBranches in the central tool registry.
    gitlab_compare_branches: repoHandlers.compareBranches,
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 states the action ('compare') but doesn't clarify if this is a read-only operation, what the output includes (e.g., diff details, commit list), or any side effects like rate limits or authentication needs. For a tool with no annotations, this is a significant gap in transparency.

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 extremely concise with a single phrase 'Compare branches, tags or commits', which is front-loaded and wastes no words. It efficiently communicates the core purpose without unnecessary elaboration, making it easy to parse quickly.

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

Completeness2/5

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

Given the complexity of a comparison tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the comparison entails, the return format, or any behavioral traits. For a tool that likely outputs detailed diff or commit data, this lack of context makes it inadequate for effective agent use.

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 input schema has 100% description coverage, with clear documentation for 'from', 'to', and 'project_id'. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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

Purpose3/5

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

The description 'Compare branches, tags or commits' states the action (compare) and the resources involved (branches, tags, commits), which is clear but vague. It doesn't specify what 'compare' means in this context (e.g., diff, statistics, or commit history) or distinguish it from sibling tools like 'gitlab_get_merge_request_changes' or 'gitlab_list_branches', which might overlap in functionality.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, context (e.g., for code review or deployment checks), or exclusions, leaving the agent to infer usage from the name alone. This lack of explicit direction reduces its effectiveness in tool selection.

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

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

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