Skip to main content
Glama

Get Commit

get_commit
Read-onlyIdempotent

Retrieve detailed commit metadata, author info, and unified diffs for a specific commit SHA or reference to review code changes or investigate regressions. Diffs are token-optimized and truncated.

Instructions

Get detailed commit metadata, author information, message, and unified git diffs for a specific commit SHA or reference. Eager daily driver tool for reviewing code modifications, patches, or investigating regressions. Output diffs are token-optimized and automatically truncated to max_diff_lines (default: 400 lines).

Input Schema

NameRequiredDescriptionDefault
refYesCommit SHA, branch name, or tag reference to inspect
pathNoOptional file path filter: only include diff and stats for this single file
repoYesRepository name (e.g. 'Hello-World' or 'mcp-github')
ownerYesRepository owner (user or organization, e.g. 'octocat' or 'buggycode')
formatYesOutput format: 'markdown' (default) or 'json'markdown
max_diff_linesYesMaximum unified diff lines to return across files to conserve LLM context tokens (default: 400)
ignore_lockfilesYesIf true, automatically collapses diffs for lockfiles and minified assets (default: true)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv2.2.0
    • removedInput schema / properties / file_path
      Removed value: -{
      -  "description": "Optional file path filter: only include diff and stats for this single file",
      -  "type": "string"
      -}
    • addedInput schema / properties / format
      Added value: +{
      +  "default": "markdown",
      +  "description": "Output format: 'markdown' (default) or 'json'",
      +  "enum": [
      +    "json",
      +    "markdown"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / ignore_lockfiles
      Added value: +{
      +  "default": true,
      +  "description": "If true, automatically collapses diffs for lockfiles and minified assets (default: true)",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / path
      Added value: +{
      +  "description": "Optional file path filter: only include diff and stats for this single file",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "owner",
      -  "repo",
      -  "ref",
      -  "max_diff_lines"
      -]New value: +[
      +  "owner",
      +  "repo",
      +  "ref",
      +  "max_diff_lines",
      +  "ignore_lockfiles",
      +  "format"
      +]
  2. Addedv2.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, non-destructive behavior, so safety is covered. The description adds genuinely useful behavioral context beyond that: output diffs are token-optimized and automatically truncated to max_diff_lines (default 400), which warns the agent that results may be incomplete for large commits. It stops short of describing error behavior for invalid refs.

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?

Three tight sentences, front-loaded with the purpose and return contents, followed by the use case and then the truncation caveat. No filler and nothing is buried.

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?

With no output schema, the description must carry the return-shape burden, and it does: it lists metadata, author info, message, and unified diffs. It is slightly thin on edge cases (e.g., behavior when a ref is invalid or a commit is large beyond truncation), which keeps it from a 5.

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 description coverage is 100%, so every parameter including ref, path, max_diff_lines and ignore_lockfiles is already documented in the schema. The description's mention of truncation at max_diff_lines (default 400) restates what the schema property already says, adding little new semantic value. Baseline 3 is appropriate.

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 and resource ('Get detailed commit metadata... unified git diffs for a specific commit SHA or reference') and enumerates exactly what is returned (metadata, author, message, diffs). This is clearly distinguishable from sibling tools get_repository and get_file_contents, which operate on repositories and files rather than commit history.

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 usage contexts ('reviewing code modifications, patches, or investigating regressions') and signals this is a frequently-used 'daily driver' tool. It does not name alternatives or state when not to use it, so it falls short of the explicit when/when-not/alternatives bar for a 5.

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