Skip to main content
Glama
archish9

GitHub MCP Server

by archish9

rollback_to_commit

Reset a Git repository to a previous commit using soft, mixed, or hard modes to undo changes while controlling what happens to staged and working directory files.

Instructions

Roll back the repository state to a previous commit.

This tool resets the current branch head to commit_sha. The mode determines what happens to the working directory and index:

  • "soft" (Default): Undoes the commit(s) but leaves changes staged in the index. Useful if you want to squash commits or fix the last commit message.

  • "mixed": Undoes the commit(s) and unstages changes, but keeps the files in the working directory. Useful if you want to keep the work but start fresh with staging.

  • "hard": WARNING - Destructive! Resets everything to the state of commit_sha. Any uncommitted changes (staged or unstaged) will be PERMANENTLY LOST. Use this only if you want to discard all work since commit_sha.

Args: repo_path: The absolute path to the repository. commit_sha: The full or short SHA of the commit to revert to. mode: The reset mode: "soft", "mixed", or "hard".

Returns: A message confirming the rollback and the new HEAD SHA.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
commit_shaYes
modeNosoft

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure and does so comprehensively. It explains the destructive nature of 'hard' mode with explicit warnings about permanent data loss, describes what happens to the working directory and index for each mode, and clarifies the default behavior. This goes well beyond what the input schema provides.

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 perfectly structured with a clear opening statement, organized bullet points for mode explanations, and separate sections for Args and Returns. Every sentence adds value, with no redundancy or wasted words, making it easy to scan while remaining comprehensive.

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 complex, potentially destructive operation with 3 parameters and no annotations, the description provides complete context: purpose, detailed parameter semantics, behavioral implications of each mode, warnings about data loss, and confirmation of what's returned. The existence of an output schema means the description doesn't need to detail return format, allowing focus on the critical behavioral aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 0% schema description coverage, the description fully documents all three parameters with clear semantic meaning: repo_path as 'absolute path to the repository', commit_sha as 'full or short SHA', and mode with detailed explanations of each option's behavior. The description completely compensates for the schema's lack of parameter documentation.

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 specific action ('roll back the repository state') and target resource ('to a previous commit'), distinguishing it from siblings like commit_all_changes or compare_commits. It precisely defines the verb+resource combination without ambiguity.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use each mode: 'soft' for squashing commits or fixing messages, 'mixed' for keeping work but restarting staging, and 'hard' only when wanting to discard all work since the commit. It clearly distinguishes use cases and includes warnings about when NOT to use certain modes.

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/archish9/VersionControlHelperMCP'

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