Skip to main content
Glama
bsreeram08

Git Repo Browser MCP

git_push

Push local Git repository changes to a remote repository. Use this tool to upload commits and synchronize code with remote servers.

Instructions

Push changes to a remote repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYesThe path to the local Git repository
remoteNoRemote nameorigin
branchNoBranch to push (default: current branch)
forceNoWhether to force push

Implementation Reference

  • The core handler function that executes the git push operation. It initializes simpleGit in the repo_path, auto-detects the current branch if none specified, pushes to the given remote/branch with optional --force, and returns an MCP-formatted response with success details or error.
    export async function handleGitPush({
      repo_path,
      remote = "origin",
      branch = null,
      force = false,
    }) {
      try {
        const git = simpleGit(repo_path);
    
        // If no branch specified, get the current branch
        if (!branch) {
          const branchInfo = await git.branch();
          branch = branchInfo.current;
        }
    
        // Perform the push
        let pushOptions = [];
        if (force) {
          pushOptions.push("--force");
        }
    
        const pushResult = await git.push(remote, branch, pushOptions);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  success: true,
                  result: pushResult,
                  message: `Pushed ${branch} to ${remote}`,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                { error: `Failed to push changes: ${error.message}` },
                null,
                2
              ),
            },
          ],
          isError: true,
        };
      }
    }
  • Defines the input schema and metadata for the 'git_push' tool in the toolsList array, used by ListToolsRequestHandler. Specifies required repo_path and optional remote, branch, force parameters.
    {
      name: "git_push",
      description: "Push changes to a remote repository.",
      inputSchema: {
        type: "object",
        properties: {
          repo_path: {
            type: "string",
            description: "The path to the local Git repository",
          },
          remote: {
            type: "string",
            description: "Remote name",
            default: "origin",
          },
          branch: {
            type: "string",
            description: "Branch to push (default: current branch)",
          },
          force: {
            type: "boolean",
            description: "Whether to force push",
            default: false,
          },
        },
        required: ["repo_path"],
      },
    },
  • src/server.js:912-912 (registration)
    Registers 'git_push' tool name to the handleGitPush function in the handlersMap object, enabling fast lookup during CallToolRequest handling.
    git_push: handleGitPush,
  • src/server.js:21-24 (registration)
    Imports the handleGitPush handler from handlers/index.js (which re-exports from remote-operations.js) into the server class.
    handleGitDeleteBranch,
    handleGitMergeBranch,
    handleGitPush,
    handleGitPull,
  • Imports simpleGit utility from common.js, used throughout the handler for Git operations.
    import { simpleGit } from "./common.js";
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'push changes' implies a write/mutation operation, the description doesn't mention potential destructive effects (especially with force push), authentication requirements, error conditions (e.g., non-fast-forward errors), or what happens on success/failure. For a mutation tool with zero annotation coverage, this is inadequate.

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 with zero wasted words. It's front-loaded with the core action and target, making it immediately understandable. Every word earns its place, and there's no unnecessary elaboration or repetition.

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 this is a mutation tool with no annotations, no output schema, and multiple parameters, the description is incomplete. It doesn't address behavioral aspects like safety, authentication, error handling, or output format. While the schema covers parameters well, the description fails to provide the contextual information needed for safe and effective tool invocation.

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 fully documents all four parameters. The description adds no additional parameter information beyond what's in the schema properties. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 ('push changes') and target ('to a remote repository'), providing a specific verb+resource combination. It distinguishes itself from siblings like git_commit, git_pull, and git_merge_branch by focusing on the upload operation. However, it doesn't explicitly differentiate from all siblings (e.g., git_lfs_fetch also involves remote operations).

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. It doesn't mention prerequisites (e.g., needing commits first), when force pushing is appropriate, or how it differs from related tools like git_push_all or git_push_tags (if they existed). With siblings like git_commit and git_pull available, the lack of contextual guidance is a significant gap.

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