Skip to main content
Glama

Git Undo Last Commit

git_undo_last_commit
Destructive

Soft-reset the last commit, removing it while keeping all changes staged for re-commit or further edits.

Instructions

Soft-reset the last commit (git reset --soft HEAD~1): removes the commit but keeps all its changes staged. Safe — no work is lost.

Args:

  • repo_path (string, optional): repository path (default: server cwd)

Returns JSON: { undoneSha, message }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathNoPath to the git repository. Defaults to the server's working directory.
Behavior4/5

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

Annotations provide destructiveHint: true, and the description elaborates that the commit is removed but changes remain staged, clarifying the 'destructive' aspect as safe. It adds context about the effect on workspace and git history beyond what annotations tell.

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 succinct, with the main action stated first, followed by the git equivalent, parameter details, and return format. No extraneous text.

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?

For a simple tool with one parameter and clear annotations, the description covers behavior, safety, and return value format. No missing information needed for correct invocation.

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% for the one parameter, and the description adds value by stating the default behavior ('default: server cwd'). The schema already includes a description, so this is clear reinforcement.

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 action ('Soft-reset the last commit') and provides the exact git command, making the purpose unmistakable. It distinguishes from siblings like 'git_commit' and 'git_create_branch' by focusing on undoing a commit.

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 explains the safety aspect ('no work is lost') and gives the git command, but lacks explicit guidance on when to use this tool versus alternatives (e.g., when the commit has not been pushed, or contrast with hard reset). No mention of preconditions or exclusions.

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/BenBen2109/ai-git-mcp'

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