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

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

Input Schema (JSON Schema)

{ "properties": { "from": { "description": "The commit SHA or branch name to compare from", "type": "string" }, "project_id": { "description": "The ID or URL-encoded path of the project", "type": "string" }, "to": { "description": "The commit SHA or branch name to compare to", "type": "string" } }, "required": [ "project_id", "from", "to" ], "type": "object" }

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,

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