Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_reset

Reset Git repository HEAD to a specified commit using soft, mixed, or hard modes to undo changes and restore previous states in development workflows.

Instructions

Reset current HEAD to specified state

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoRepository directory
modeNoReset modemixed
commitNoCommit to reset toHEAD
filesNoSpecific file(s) to reset

Implementation Reference

  • The main handler function gitReset that executes the git reset command. It handles both file-specific resets and full resets with soft/mixed/hard modes using the shared executeGitCommand helper.
    export async function gitReset(args: z.infer<typeof gitResetSchema>): Promise<ToolResponse> {
      if (args.files) {
        return executeGitCommand(`git reset ${args.commit} -- ${args.files}`, args.cwd);
      }
      const modeFlag = `--${args.mode}`;
      return executeGitCommand(`git reset ${modeFlag} ${args.commit}`, args.cwd);
    }
  • Zod schema defining the input parameters for the git_reset tool, including cwd, mode, commit, and optional files.
    export const gitResetSchema = z.object({
      cwd: z.string().optional().describe('Repository directory'),
      mode: z.enum(['soft', 'mixed', 'hard']).optional().default('mixed').describe('Reset mode'),
      commit: z.string().optional().default('HEAD').describe('Commit to reset to'),
      files: z.string().optional().describe('Specific file(s) to reset')
    });
  • The tool registration object within the gitTools array that defines the git_reset tool for the MCP listTools endpoint.
    {
      name: 'git_reset',
      description: 'Reset current HEAD to specified state',
      inputSchema: {
        type: 'object',
        properties: {
          cwd: { type: 'string', description: 'Repository directory' },
          mode: { type: 'string', enum: ['soft', 'mixed', 'hard'], default: 'mixed', description: 'Reset mode' },
          commit: { type: 'string', default: 'HEAD', description: 'Commit to reset to' },
          files: { type: 'string', description: 'Specific file(s) to reset' }
        }
      }
    },
  • src/index.ts:421-424 (registration)
    Dispatch/registration logic in the main MCP server handler that routes 'git_reset' calls to the gitReset function after schema validation.
    if (name === 'git_reset') {
      const validated = gitResetSchema.parse(args);
      return await gitReset(validated);
    }
  • Shared helper function executeGitCommand used by gitReset (and all git tools) to run git commands and format responses.
    async function executeGitCommand(command: string, cwd?: string): Promise<ToolResponse> {
      try {
        const { stdout, stderr } = await execAsync(command, {
          cwd: cwd || process.cwd(),
          shell: '/bin/bash',
          maxBuffer: 10 * 1024 * 1024 // 10MB buffer
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: true,
                command: command,
                stdout: stdout.trim(),
                stderr: stderr.trim(),
                cwd: cwd || process.cwd()
              }, null, 2)
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: false,
                command: command,
                stdout: error.stdout?.trim() || '',
                stderr: error.stderr?.trim() || error.message,
                exitCode: error.code || 1,
                cwd: cwd || process.cwd()
              }, null, 2)
            }
          ],
          isError: true
        };
      }
    }
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. It states the action ('Reset') but doesn't explain critical behaviors: that this is a destructive operation (especially in 'hard' mode), that it can rewrite history, what happens to staged/unstaged changes, or any error conditions. For a mutation tool with zero annotation coverage, this is a significant gap.

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, front-loaded sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a tool with a clear name and well-documented schema, earning its place efficiently.

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?

Given the tool's complexity (a Git operation with destructive potential), lack of annotations, and no output schema, the description is incomplete. It doesn't address safety implications, return values, or error handling, which are crucial for an agent to use this tool correctly in context with sibling Git tools.

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%, with clear parameter descriptions in the schema (e.g., 'Repository directory' for cwd, 'Reset mode' for mode). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for adequate coverage without extra value.

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 'Reset current HEAD to specified state' clearly states the verb ('Reset') and resource ('current HEAD'), making the purpose understandable. However, it doesn't differentiate from sibling Git tools like 'git_revert' or 'git_checkout', which also modify repository state, leaving some ambiguity about when to choose this specific reset operation.

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?

No guidance is provided on when to use this tool versus alternatives. The description lacks context about scenarios where git_reset is appropriate compared to other Git commands like revert, checkout, or rebase, which are available as siblings. This omission leaves the agent without usage direction.

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/ConnorBoetig-dev/mcp2'

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