Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

git_push

Push Git commits to remote repositories to synchronize local changes with team members and deployment environments.

Instructions

Push commits to remote repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNoRepository directory
remoteNoRemote nameorigin
branchNoBranch to push (defaults to current branch)
forceNoForce push (use with caution)
setUpstreamNoSet upstream tracking

Implementation Reference

  • The gitPush function implements the core logic for the git_push tool by constructing and executing the appropriate git push command using the shared executeGitCommand helper.
    export async function gitPush(args: z.infer<typeof gitPushSchema>): Promise<ToolResponse> {
      const forceFlag = args.force ? '--force' : '';
      const upstreamFlag = args.setUpstream ? '-u' : '';
      const branch = args.branch || '';
      return executeGitCommand(`git push ${upstreamFlag} ${forceFlag} ${args.remote} ${branch}`.trim(), args.cwd);
    }
  • Zod schema used for input validation of git_push tool arguments in the handler dispatch.
    export const gitPushSchema = z.object({
      cwd: z.string().optional().describe('Repository directory'),
      remote: z.string().optional().default('origin').describe('Remote name'),
      branch: z.string().optional().describe('Branch to push (defaults to current branch)'),
      force: z.boolean().optional().default(false).describe('Force push (use with caution)'),
      setUpstream: z.boolean().optional().default(false).describe('Set upstream tracking')
    });
  • src/index.ts:389-392 (registration)
    Registration and dispatch logic in the main MCP server handler that routes 'git_push' calls to the gitPush function after validation.
    if (name === 'git_push') {
      const validated = gitPushSchema.parse(args);
      return await gitPush(validated);
    }
  • MCP-compatible JSON schema definition for the git_push tool, included in the gitTools array returned by listTools.
    {
      name: 'git_push',
      description: 'Push commits to remote repository',
      inputSchema: {
        type: 'object',
        properties: {
          cwd: { type: 'string', description: 'Repository directory' },
          remote: { type: 'string', default: 'origin', description: 'Remote name' },
          branch: { type: 'string', description: 'Branch to push (defaults to current branch)' },
          force: { type: 'boolean', default: false, description: 'Force push (use with caution)' },
          setUpstream: { type: 'boolean', default: false, description: 'Set upstream tracking' }
        }
      }
    },
  • Shared helper function executeGitCommand that all git tools (including gitPush) use 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?

With no annotations provided, the description carries full burden for behavioral disclosure. 'Push commits' implies a write operation that modifies remote state, but it doesn't mention potential side effects (e.g., overwriting remote changes, requiring authentication), error conditions, or what happens on success. 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 function without unnecessary words. It's appropriately sized and front-loaded, with zero wasted content.

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 mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'push' entails behaviorally (e.g., network operation, potential conflicts), return values, or error handling. Given the complexity of git operations, more context is needed.

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 fully documents all 5 parameters. The description adds no parameter-specific information beyond what's in the schema, meeting the baseline for high coverage but not providing extra semantic context.

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 verb ('push') and resource ('commits to remote repository'), making the purpose immediately understandable. It doesn't differentiate from sibling git tools like git_pull or git_fetch, but it's not tautological or misleading.

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 like git_fetch or git_pull, nor does it mention prerequisites (e.g., needing commits ready to push). It's a basic statement of function without contextual usage advice.

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