Skip to main content
Glama
bsreeram08

Git Repo Browser MCP

git_reset

Reset a Git repository to a specific commit or state using soft, mixed, or hard reset modes to undo changes and restore previous versions.

Instructions

Reset repository to specified commit or state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYesThe path to the local Git repository
modeNoReset mode (soft, mixed, hard)mixed
toNoCommit or reference to reset toHEAD

Implementation Reference

  • Main handler function that performs git reset (soft, mixed, hard) to a specified commit or HEAD using simpleGit.
    export async function handleGitReset({
      repo_path,
      mode = "mixed",
      to = "HEAD",
    }) {
      try {
        const git = simpleGit(repo_path);
    
        // Check valid mode
        if (!["soft", "mixed", "hard"].includes(mode)) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    error: `Invalid reset mode: ${mode}. Use 'soft', 'mixed', or 'hard'.`,
                  },
                  null,
                  2
                ),
              },
            ],
            isError: true,
          };
        }
    
        // Perform the reset
        await git.reset([`--${mode}`, to]);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  success: true,
                  message: `Reset (${mode}) to ${to}`,
                  mode: mode,
                  target: to,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                { error: `Failed to reset repository: ${error.message}` },
                null,
                2
              ),
            },
          ],
          isError: true,
        };
      }
    }
  • Tool schema definition including input parameters repo_path (required), mode (default mixed), and to (default HEAD).
      name: "git_reset",
      description: "Reset repository to specified commit or state.",
      inputSchema: {
        type: "object",
        properties: {
          repo_path: {
            type: "string",
            description: "The path to the local Git repository",
          },
          mode: {
            type: "string",
            description: "Reset mode (soft, mixed, hard)",
            default: "mixed",
            enum: ["soft", "mixed", "hard"],
          },
          to: {
            type: "string",
            description: "Commit or reference to reset to",
            default: "HEAD",
          },
        },
        required: ["repo_path"],
      },
    },
  • src/server.js:918-918 (registration)
    Maps the 'git_reset' tool name to the handleGitReset handler function in the server's handlersMap.
    git_reset: handleGitReset,
  • Re-exports handleGitReset from advanced-operations.js for use in server.js.
    handleGitReset,
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'reset' implies mutation, the description doesn't explain what 'reset' actually does, the implications of different modes (soft/mixed/hard), whether changes are destructive or reversible, or what happens to staged/unstaged changes. This is inadequate for a mutation tool with zero annotation coverage.

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 a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a tool with clear parameters and no complex behavioral nuances to explain.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a Git reset operation - which can be destructive and has multiple modes with different implications - the description is insufficient. With no annotations, no output schema, and behavioral details missing, the agent lacks crucial information about what this tool actually does, its safety profile, and what to expect from its execution.

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 documents all three parameters thoroughly. The description mentions 'specified commit or state' which aligns with the 'to' parameter, but adds no additional semantic context beyond what the schema provides. This meets the baseline for high schema coverage.

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?

The description clearly states the action ('reset') and target ('repository to specified commit or state'), making the purpose immediately understandable. However, it doesn't differentiate this tool from similar sibling tools like git_revert or git_checkout_branch, which also modify repository state.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like git_revert, git_checkout_branch, and git_clean that also modify repository state, the agent receives no help in choosing between them. There's no mention of prerequisites, typical use cases, or when-not-to-use scenarios.

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/bsreeram08/git-commands-mcp'

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