Skip to main content
Glama
Alosies
by Alosies

get_commit_diff

Retrieve detailed changes and differences for a specific GitLab commit by providing project ID and commit hash to analyze code modifications.

Instructions

Get changes/diffs of a specific commit

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
shaYesThe commit hash or name of a repository branch or tag

Implementation Reference

  • The main handler function that executes the get_commit_diff tool by calling the GitLab API to retrieve the diff for a specific commit and returns it as JSON.
    async getCommitDiff(args: GetCommitDiffParams) { const data = await this.client.get( `/projects/${encodeURIComponent( args.project_id )}/repository/commits/${encodeURIComponent(args.sha)}/diff` ); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
  • MCP tool definition including the input schema for get_commit_diff, used for tool listing and validation.
    { name: "get_commit_diff", description: "Get changes/diffs of a specific commit", inputSchema: { type: "object", properties: { project_id: { type: "string", description: "Project ID or path", }, sha: { type: "string", description: "The commit hash or name of a repository branch or tag", }, }, required: ["project_id", "sha"], }, },
  • TypeScript interface defining the parameters for the getCommitDiff handler.
    export interface GetCommitDiffParams { project_id: string; sha: string; }
  • src/server.ts:281-284 (registration)
    Registration of the tool call handler in the main server switch statement, dispatching to the repository handler.
    case "get_commit_diff": return await this.repositoryHandlers.getCommitDiff( args as unknown as GetCommitDiffParams );

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

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