Skip to main content
Glama

get_commit_diff

Read-only

Retrieve the changes and diffs for a specific commit in a GitLab project. Provide the project ID and commit SHA to see exactly what was modified.

Instructions

Get changes/diffs of a specific commit. Use this for a known resource or result; choose the corresponding list or search tool when you need to discover multiple resources. It is read-only and does not mutate GitLab data; missing resources, invalid identifiers, insufficient permission, and rate limits are returned as errors. When project_id or group_id is accepted, provide the numeric ID or complete URL-encoded path described by the schema; use required identifiers and pagination fields exactly as documented.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
shaYesThe commit hash or name of a repository branch or tag
jmespathNoOptional JMESPath expression filtering the JSON result before return.
full_diffNoWhether to return the full diff or only first page (default: false)
project_idYesProject ID or complete URL-encoded path to project

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.1.66
    • addedInput schema / properties / jmespath
      Added value: +{
      +  "description": "Optional JMESPath expression filtering the JSON result before return.",
      +  "type": "string"
      +}
  2. Changed1 schema field changedv2.1.62
    • changedInput schema / required
      Previous value: -[
      -  "sha",
      -  "project_id"
      -]New value: +[
      +  "project_id",
      +  "sha"
      +]
  3. Addedv2.1.45
  4. Removedv2.1.43
  5. Addedv2.1.18
  6. Removedv2.1.14
  7. Addedv2.1.11
  8. Removedv2.1.10
  9. Changed2 schema fields changedv2.1.9
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / required
      Previous value: -[
      -  "sha"
      -]New value: +[
      +  "sha",
      +  "project_id"
      +]
  10. First observedv1.0.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, but the description adds non-redundant behavioral details: missing resources, invalid identifiers, insufficient permission, and rate limits are returned as errors. This clarifies the error contract beyond what annotations provide. It does not describe return formatting, but that is covered by schema fields like full_diff.

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 a few sentences long but each sentence earns its place: purpose, usage delineation, read-only/error note, parameter guidance. It is front-loaded with the primary action and then adds necessary context. Slightly verbose but not bloated; it avoids redundancy with annotations by noting error behavior instead of repeating read-only (though it does repeat read-only). Overall, well-structured and efficient.

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

Completeness4/5

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

For a specific-commit diff tool with no output schema, the description covers purpose, usage boundaries, error behavior, and parameter guidance. It lacks explicit mention of the response format, but the full_diff parameter implies pagination and the diff itself is a standard git structure. Given the schema covers all parameters and annotations cover safety, this description is sufficiently complete for an agent to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds extra guidance on parameter usage: 'provide the numeric ID or complete URL-encoded path described by the schema' and 'use required identifiers and pagination fields exactly as documented'. This goes beyond the schema's basic field descriptions, clarifying the expected format and constraint that parameters must be used exactly as documented.

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

Purpose5/5

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

States specific verb 'Get changes/diffs' and resource 'a specific commit'. Clearly differentiates from list/search tools by explicitly saying 'Use this for a known resource or result' and directing to 'the corresponding list or search tool' for discovery. Distinguishes from siblings like get_commit or list_merge_request_diffs without ambiguity.

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

Usage Guidelines4/5

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

Provides explicit when-to-use (known resource) and when-not-to (discover multiple resources) guidance, and mentions error conditions. Does not name specific sibling tools but the 'corresponding list or search tool' is contextually clear. Overall, strong usage direction with only minor lack of exact sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools