Skip to main content
Glama

Compare exact Git commits

gh_compare_commits
Read-onlyIdempotent

Compare two exact 40-character commit SHAs in a GitHub repo to get merge-base status, commit metadata, and changed files with completeness indicators and SHA-256 fingerprints.

Instructions

Read-only: compare two exact 40-character commit SHAs without branch or tag resolution. Returns explicit merge-base/status evidence plus independently bounded commit and changed-file metadata with completeness and SHA-256 fingerprints.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoYesGitHub repository name without the owner prefix.
ownerYesGitHub repository owner or organization login.
base_shaYesExact 40-character hexadecimal base commit SHA.
head_shaYesExact 40-character hexadecimal head commit SHA.
max_filesNoMaximum changed-file metadata records to return. Defaults to the server result limit; the implementation retains a strict bound below GitHub's 300-file upstream saturation point so incompleteness is never ambiguous.
max_commitsNoMaximum commit records to return. Defaults to the server result limit and cannot exceed GitHub's 100-commit comparison page limit.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYes
sha256Yes
statusNo
commitsYes
warningNo
ahead_byNo
base_shaYes
head_shaYes
behind_byNo
truncatedYes
base_foundYes
head_foundYes
total_commitsNo
files_evidenceYes
merge_base_shaNo
commits_evidenceYes
evidence_completeYes
comparison_availableYes
Behavior5/5

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

Annotations already declare readOnlyHint, openWorldHint, idempotentHint, and destructiveHint false. The description adds substantial behavioral context: it explains the output includes 'explicit merge-base/status evidence,' 'independently bounded commit and changed-file metadata with completeness and SHA-256 fingerprints,' and mentions the '40-character' constraint. These details go well beyond the annotations, revealing the tool's thoroughness and data integrity guarantees.

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 two concise sentences, front-loaded with 'Read-only' and immediately states the core action. Every phrase adds value — no repetition or filler. It efficiently conveys scope, constraints, and output characteristics without redundancy.

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

Completeness5/5

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

Given the tool complexity (6 params, output schema present, rich annotations), the description is sufficiently complete. It covers the action, constraints, and output nature, and the output schema handles return-value specifics. No gaps are apparent; the description complements the structured data effectively.

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 coverage is 100% — all six parameters have descriptions. The description does not add meaning beyond the schema; it mentions the exact-SHA constraint (already in schema patterns) and 'independently bounded' metadata (reflected in max_files and max_commits descriptions). Since the schema fully documents parameters, the description provides no additional parameter-level insight, matching the baseline for high coverage.

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?

The description clearly states the tool 'compare[s] two exact 40-character commit SHAs without branch or tag resolution' — a specific verb and resource. It distinguishes from sibling tools like gh_get_commit (single commit) and gh_get_pr_diff (PR-based) by emphasizing exact SHAs and the explicit merge-base/status evidence it returns.

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

Usage Guidelines3/5

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

The description implies usage for exact commit comparison and explicitly notes 'without branch or tag resolution,' which hints at when to use it over branch-based comparisons. However, it does not explicitly contrast with alternatives or state when not to use it, so guidance is only inferred rather than articulated.

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/fvanevski/gh_mcp'

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