Skip to main content
Glama

git-workflow

Manage Git repositories locally and remotely with operations including init, commit, sync, backup, and repository management for GitHub and Gitea platforms.

Instructions

Core Git workflow tool for local and remote Git operations. Supports init, status, commit, sync, backup, create, list, get, update, delete, fork, and search operations. Provides comprehensive Git repository management with both local and remote provider support (GitHub/Gitea).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe Git operation to perform. Local operations: init, status, commit, sync, backup. Remote operations: create, list, get, update, delete, fork, search (require provider parameter).
backupPathNoPath for backup file (for backup action)
bareNoInitialize as bare repository (for init action)
branchNoBranch name for sync
descriptionNoRepository description (for create/update actions)
filesNoSpecific files to commit (default: all changes)
forceNoForce operation (for sync action)
messageNoCommit message (required for commit action)
nameNoRepository name (for create action)
ownerNoRepository owner (for get/update/delete/fork actions)
privateNoCreate private repository (for create action)
projectPathYesAbsolute path to the project directory
providerNoProvider for remote operations (required for remote operations)
queryNoSearch query (for search action)
remoteNoRemote name for sync (default: origin)
repoNoRepository name (for get/update/delete/fork actions)

Implementation Reference

  • Main execute handler for git-workflow tool: validates parameters, routes local Git operations (init, commit, sync, push, pull, status, backup) or remote repository operations (create, list, get, update, delete, fork, search) via providers.
    async execute(params: GitWorkflowParams): Promise<ToolResult> {
      const startTime = Date.now();
    
      try {
        // Validate basic parameters
        const validation = ParameterValidator.validateToolParams('git-workflow', params);
        if (!validation.isValid) {
          return OperationErrorHandler.createToolError(
            'VALIDATION_ERROR',
            `Parameter validation failed: ${validation.errors.join(', ')}`,
            params.action,
            { validationErrors: validation.errors },
            validation.suggestions
          );
        }
    
        // Validate operation-specific parameters
        const operationValidation = ParameterValidator.validateOperationParams('git-workflow', params.action, params);
        if (!operationValidation.isValid) {
          return OperationErrorHandler.createToolError(
            'VALIDATION_ERROR',
            `Operation validation failed: ${operationValidation.errors.join(', ')}`,
            params.action,
            { validationErrors: operationValidation.errors },
            operationValidation.suggestions
          );
        }
    
        // Route to appropriate handler
        const isRemoteOperation = this.isRemoteOperation(params.action);
    
        if (isRemoteOperation) {
          return await this.executeRemoteOperation(params, startTime);
        } else {
          return await this.executeLocalOperation(params, startTime);
        }
    
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        return OperationErrorHandler.createToolError(
          'EXECUTION_ERROR',
          `Failed to execute ${params.action}: ${errorMessage}`,
          params.action,
          { error: errorMessage },
          ['Check the error details and try again']
        );
      }
    }
  • Tool schema definition for MCP registration, including name, description, and detailed inputSchema with all parameters for git-workflow.
    static getToolSchema() {
      return {
        name: 'git-workflow',
        description: 'Core Git workflow tool for local and remote Git operations. Supports init, status, commit, sync, backup, create, list, get, update, delete, fork, and search operations. Provides comprehensive Git repository management with both local and remote provider support (GitHub/Gitea). In universal mode (GIT_MCP_MODE=universal), automatically executes on both GitHub and Gitea providers.',
        inputSchema: {
          type: 'object',
          properties: {
            action: {
              type: 'string',
              enum: ['init', 'status', 'commit', 'sync', 'backup', 'push', 'pull', 'create', 'list', 'get', 'update', 'delete', 'fork', 'search'],
              description: 'The Git operation to perform. Local operations: init, status, commit, sync, backup. Remote operations: create, list, get, update, delete, fork, search (require provider parameter).'
            },
            projectPath: {
              type: 'string',
              description: 'Absolute path to the project directory'
            },
            provider: {
              type: 'string',
              enum: ['github', 'gitea', 'both'],
              description: 'Provider for remote operations (required for remote operations)'
            },
            message: {
              type: 'string',
              description: 'Commit message (required for commit action)'
            },
            files: {
              type: 'array',
              items: { type: 'string' },
              description: 'Specific files to commit (default: all changes)'
            },
            bare: {
              type: 'boolean',
              description: 'Initialize as bare repository (for init action)'
            },
            backupPath: {
              type: 'string',
              description: 'Path for backup file (for backup action)'
            },
            name: {
              type: 'string',
              description: 'Repository name (for create action)'
            },
            description: {
              type: 'string',
              description: 'Repository description (for create/update actions)'
            },
            private: {
              type: 'boolean',
              description: 'Create private repository (for create action)'
            },
            query: {
              type: 'string',
              description: 'Search query (for search action)'
            },
            repo: {
              type: 'string',
              description: 'Repository name (for get/update/delete/fork actions)'
            },
            remote: {
              type: 'string',
              description: 'Remote name for sync (default: origin)'
            },
            branch: {
              type: 'string',
              description: 'Branch name for sync'
            },
            force: {
              type: 'boolean',
              description: 'Force operation (for sync action)'
            },
            pushRemote: {
              type: 'string',
              description: 'Remote name for push (default: origin)'
            },
            pushBranch: {
              type: 'string',
              description: 'Branch name for push (default: current branch)'
            },
            pullRemote: {
              type: 'string',
              description: 'Remote name for pull (default: origin)'
            },
            pullBranch: {
              type: 'string',
              description: 'Branch name for pull (default: current branch)'
            }
          },
          required: ['action', 'projectPath']
        }
      };
    }
  • src/server.ts:122-146 (registration)
    Registration of git-workflow schema in MCP listTools handler via GitWorkflowTool.getToolSchema().
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          GitWorkflowTool.getToolSchema(),
          GitFilesTool.getToolSchema(),
          GitBranchesTool.getToolSchema(),
          GitIssuesTool.getToolSchema(),
          GitPullsTool.getToolSchema(),
          GitTagsTool.getToolSchema(),
          GitReleaseTool.getToolSchema(),
          GitRemoteTool.getToolSchema(),
          GitResetTool.getToolSchema(),
          GitStashTool.getToolSchema(),
          GitConfigTool.getToolSchema(),
          GitMonitorTool.getToolSchema(),
          GitBackupTool.getToolSchema(),
          GitArchiveTool.getToolSchema(),
          GitSyncTool.getToolSchema(),
          GitPackagesTool.getToolSchema(),
          GitAnalyticsTool.getToolSchema(),
          GitUpdateTool.getToolSchema(),
          GitHistoryTool.getToolSchema()
        ]
      };
    });
  • src/server.ts:468-511 (registration)
    Tool execution dispatch for git-workflow in server switch statement calling this.gitWorkflowTool.execute().
    private async executeTool(name: string, args: any): Promise<any> {
      switch (name) {
        case 'git-workflow':
          return await this.gitWorkflowTool.execute(args);
        case 'git-files':
          return await this.gitFilesTool.execute(args);
        case 'git-branches':
          return await this.gitBranchesTool.execute(args);
        case 'git-issues':
          return await this.gitIssuesTool.execute(args);
        case 'git-pulls':
          return await this.gitPullsTool.execute(args);
        case 'git-tags':
          return await this.gitTagsTool.execute(args);
        case 'git-release':
          return await this.gitReleaseTool.execute(args);
        case 'git-remote':
          return await this.gitRemoteTool.execute(args);
        case 'git-reset':
          return await this.gitResetTool.execute(args);
        case 'git-stash':
          return await this.gitStashTool.execute(args);
        case 'git-config':
          return await this.gitConfigTool.execute(args);
        case 'git-monitor':
          return await this.gitMonitorTool.execute(args);
        case 'git-backup':
          return await this.gitBackupTool.execute(args);
        case 'git-archive':
          return await this.gitArchiveTool.execute(args);
        case 'git-sync':
          return await this.gitSyncTool.execute(args);
        case 'git-packages':
          return await this.gitPackagesTool.execute(args);
        case 'git-analytics':
          return await this.gitAnalyticsTool.execute(args);
        case 'git-update':
          return await this.gitUpdateTool.execute(args);
        case 'git-history':
          return await this.gitHistoryTool.execute(args);
        default:
          throw new Error(`Tool execution not implemented: ${name}`);
      }
    }
  • src/server.ts:87-87 (registration)
    Instantiation of GitWorkflowTool instance in server initialization with provider config.
    this.gitWorkflowTool = new GitWorkflowTool(providerConfig);
  • TOOL_OPERATIONS constant defining supported actions for git-workflow used in validation.
    private static readonly TOOL_OPERATIONS: Record<string, string[]> = {
      'git-workflow': ['init', 'commit', 'sync', 'status', 'backup', 'push', 'pull', 'create', 'list', 'get', 'update', 'delete', 'fork', 'search'],
      'git-files': ['read', 'search', 'backup', 'list'],
      'git-branches': ['create', 'list', 'get', 'delete', 'merge', 'compare'],
      'git-issues': ['create', 'list', 'get', 'update', 'close', 'comment', 'search'],
      'git-pulls': ['create', 'list', 'get', 'update', 'merge', 'close', 'review', 'search'],
      'git-tags': ['create', 'list', 'get', 'delete', 'search'],
      'git-release': ['create', 'list', 'get', 'update', 'delete', 'publish', 'download'],
      'git-remote': ['add', 'remove', 'rename', 'show', 'set-url', 'prune', 'list'],
      'git-reset': ['soft', 'mixed', 'hard', 'reset-to-commit', 'reset-branch'],
      'git-stash': ['stash', 'pop', 'apply', 'list', 'show', 'drop', 'clear'],
      'git-config': ['get', 'set', 'unset', 'list', 'edit', 'show'],
      'git-monitor': ['log', 'status', 'commits', 'contributors'],
      'git-backup': ['backup', 'restore', 'list', 'verify'],
      'git-archive': ['create', 'extract', 'list', 'verify'],
      'git-packages': ['list', 'get', 'create', 'update', 'delete', 'publish', 'download'],
      'git-analytics': ['stats', 'commits', 'contributors'],
      'git-sync': ['sync', 'status'],
      'git-update': ['update', 'history', 'changelog', 'track', 'sync-providers', 'status', 'rollback', 'compare'],
      'git-history': ['log', 'track', 'sync', 'export', 'auto']
    };
  • Operation-specific parameter validation for git-workflow actions.
    private static validateWorkflowParams(action: string, params: ToolParams): ValidationResult {
      const result: ValidationResult = {
        isValid: true,
        errors: [],
        warnings: [],
        suggestions: []
      };
    
      switch (action) {
        case 'commit':
          if (!params.message) {
            result.errors.push('message is required for commit operation');
            result.suggestions.push('Provide a commit message describing your changes');
            result.isValid = false;
          }
          break;
        case 'create':
          if (!params.name) {
            result.errors.push('name is required for repository creation');
            result.suggestions.push('Provide a repository name');
            result.isValid = false;
          }
          break;
        case 'get':
        case 'update':
        case 'delete':
        case 'fork':
          if (!params.repo) {
            result.errors.push('repo is required for repository operations');
            result.suggestions.push('Provide repository name');
            result.isValid = false;
          }
          break;
        case 'search':
          if (!params.query) {
            result.errors.push('query is required for search operation');
            result.suggestions.push('Provide a search query string');
            result.isValid = false;
          }
          break;
        case 'push':
          // Validate push parameters
          if (params.force) {
            result.warnings.push('Force push will override remote changes. Use with caution.');
          }
          break;
        case 'pull':
          // Validate pull parameters
          if (params.strategy && !['merge', 'rebase', 'fast-forward'].includes(params.strategy)) {
            result.errors.push('Invalid pull strategy. Must be one of: merge, rebase, fast-forward');
            result.suggestions.push('Use strategy: "merge", "rebase", or "fast-forward"');
            result.isValid = false;
          }
          break;
        case 'backup':
          if (params.backupPath && typeof params.backupPath !== 'string') {
            result.errors.push('backupPath must be a string');
            result.isValid = false;
          }
          break;
        case 'sync':
          if (params.remote && typeof params.remote !== 'string') {
            result.errors.push('remote must be a string');
            result.isValid = false;
          }
          if (params.branch && typeof params.branch !== 'string') {
            result.errors.push('branch must be a string');
            result.isValid = false;
          }
          break;
      }
    
      return result;
    }
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 it mentions 'comprehensive Git repository management,' it fails to describe critical behaviors such as error handling, authentication requirements for remote operations, rate limits, or whether operations are destructive (e.g., delete action). This leaves significant gaps in understanding how the tool behaves in practice.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and efficiently lists operations in two sentences. However, it could be more structured by separating local and remote operations more clearly, and the list of actions is somewhat dense without categorization, slightly reducing readability.

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 (16 parameters, no output schema, and no annotations), the description is inadequate. It doesn't explain return values, error conditions, or behavioral nuances for actions like 'delete' or 'sync.' For a multi-action tool with significant parameter complexity, more context is needed to ensure proper usage and understanding.

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?

The schema description coverage is 100%, with detailed descriptions for all 16 parameters in the input schema. The description adds minimal value beyond the schema by listing supported actions but doesn't provide additional semantic context (e.g., how actions interact or parameter dependencies). Given the high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

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 tool's purpose as a 'Core Git workflow tool for local and remote Git operations' and lists the specific operations supported (init, status, commit, etc.). It distinguishes itself from siblings by emphasizing comprehensive repository management with both local and remote support, though it doesn't explicitly contrast with specific sibling tools like git-sync or git-remote.

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

Usage Guidelines3/5

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

The description implies usage by mentioning that it supports both local and remote operations with provider support, but it doesn't provide explicit guidance on when to use this tool versus alternatives (e.g., git-sync for sync operations or git-remote for remote management). It lacks clear when-not-to-use statements or named alternatives, leaving usage context somewhat vague.

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/Andre-Buzeli/git-mcp'

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