Skip to main content
Glama

Git History Rewrite

git_rewrite
Destructive

Rewrite Git commit history by rewording, squashing, or replacing messages, with backup and restore actions; create a backup before force-pushing changed hashes.

Instructions

Rewrite commit history. Use action=reword|squash|rewrite-messages|backup|restore. History rewriting changes commit hashes and requires force-push; create a backup first.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "action": "<action>"
    },
    "name": "git_rewrite"
  }
}

Input Schema

NameRequiredDescriptionDefault
refNoCommit ref to reword (defaults to HEAD).
nameNoBackup branch name (backup/restore).
countNoNumber of commits to squash.
rangeNoCommit range to rewrite (e.g. HEAD~5..HEAD).
actionYesHistory rewrite operation.
confirmNoConfirm destructive history rewrite.
messageNoNew commit message (reword/squash).
messagesNoMap of commit SHA to replacement message (rewrite-messages).
repo_pathNoAbsolute path to the local Git repository. If omitted, falls back to the server default set via the GIT_REPO_PATH environment variable or --repo-path CLI argument.
response_formatNoOutput format for the response.markdown

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.2

TDQS

A3.8/5.0
Behavior4/5

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

The annotations already flag destructiveHint=true and non-idempotency, so the description's job is to add context, and it does: hash changes, force-push requirement, and the backup-first recommendation are real consequences not expressible in annotations. It omits any mention of the confirm flag gating destructive runs, which would have completed the picture.

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: the operation first, then the action set, then the risk warning. Every clause carries information and the risk caveat is placed where it will be read before invocation.

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 10-parameter destructive tool with full schema coverage and no output schema, the description covers purpose, modes, and consequences adequately. The remaining gap is behavioral detail around confirm and restore, which an agent must infer.

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 the schema already explains ref, count, range, messages, and the repo_path fallback chain. The description only restates the action enum values, adding no syntax, ordering, or interaction details beyond what the schema provides.

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

Purpose4/5

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

"Rewrite commit history" gives a specific verb and resource, and the enumerated action list (reword|squash|rewrite-messages|backup|restore) sharpens the scope so an agent can distinguish it from plain history readers like git_history. It stops short of naming any sibling such as git_rebase, which also rewrites commits, so the differentiation is stated but not fully delimited.

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 action enumeration implies the modes of use, and the clause "create a backup first" is a concrete prerequisite. However, there is no guidance on when to prefer this over git_rebase or git_cherry_pick, nor any statement of when a rewrite should not be attempted.

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