Skip to main content
Glama

Compare refs

compare_refs
Read-onlyIdempotent

Compare two Git refs to see how many commits one is ahead of or behind the other and list those commits newest first. Shows how far behind main a branch is or what is unreleased.

Instructions

Compare two refs (branches, tags or commits): how many commits "head" is ahead of and behind "base", and which commits those are, newest first. Useful for "how far behind main is my branch?" or "what is on this branch that is not released yet?".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseYesRef to compare against, e.g. "main" or a tag.
headNoRef to compare, e.g. a branch.HEAD
repoNoRepository name or absolute path from the allowlist. Defaults to the first configured repo.
limitNoMaximum number of results (1-100).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseYes
headYes
repoYesName of the repository that was queried.
aheadYesCommits reachable from head but not from base.
behindYesCommits reachable from base but not from head.
statusYes
truncatedYesTrue if either commit list was cut off by the limit.
baseCommitYesFull hash that "base" resolved to.
headCommitYesFull hash that "head" resolved to.
aheadCommitsYesCommits only in head, newest first.
behindCommitsYesCommits only in base, newest first.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already establish readOnly, idempotent, non-destructive, closed-world behavior, so the bar is lower. The description adds ordering semantics ("newest first") and clarifies the directional relationship between head and base, which is genuine value beyond the annotation set.

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?

Two sentences with no filler; the definition of what is returned comes first and the use-case examples follow as illustration. Every clause earns its place.

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?

An output schema exists, so return-structure detail is not required, yet the description still previews the shape of the answer. For a 4-parameter, fully documented, read-only tool, nothing an agent needs to invoke it correctly is missing.

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, but the description adds directional meaning the schema does not: base is what head is measured against, and head is what is being compared. That resolves ambiguity between two similarly-worded schema fields.

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 a specific verb (compare) and resource (two refs), and immediately defines what the comparison yields: ahead/behind commit counts plus the commit lists. This is clearly distinguished from sibling tools like recent_activity or commit_search.

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 concrete motivating scenarios ("how far behind main is my branch?", "what is on this branch that is not released yet?"), which sharpens when to reach for it. It does not, however, explicitly name alternatives such as stale_branches or commit_search for the cases it does not cover.

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