Skip to main content
Glama

git-sync

Synchronize Git repositories between local and remote providers. Perform sync operations or check status across GitHub and Gitea with configurable merge strategies and branch management.

Instructions

Advanced Git synchronization tool for intelligent sync and status operations. Supports both local Git synchronization and remote provider synchronization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe Git sync operation to perform
branchNoBranch to sync (default: current branch)
checkAheadNoCheck commits ahead/behind (default: true for status operation)
detailedNoShow detailed sync status (for status operation)
dryRunNoShow what would be done without executing (for sync operation)
forceNoForce sync (use with caution, may override uncommitted changes)
includeRemoteNoInclude remote status information (for status operation)
ownerNoRepository owner (auto-detected if not provided, for remote operations)
projectPathYesAbsolute path to the project directory
providerNoProvider for remote operations (optional for local-only operations)
remoteNoRemote to sync with (default: origin)
repoNoRepository name (auto-detected if not provided, for remote operations)
strategyNoSync strategy (default: merge)

Implementation Reference

  • Main execution handler for git-sync tool. Validates parameters, routes to sync/status handlers, and handles errors.
    async execute(params: GitSyncParams): Promise<ToolResult> {
      const startTime = Date.now();
    
      try {
        // Validate basic parameters
        const validation = ParameterValidator.validateToolParams('git-sync', 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 = this.validateOperationParams(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
        switch (params.action) {
          case 'sync':
            return await this.handleSync(params, startTime);
          case 'status':
            return await this.handleStatus(params, startTime);
          default:
            return OperationErrorHandler.createToolError(
              'UNSUPPORTED_OPERATION',
              `Unsupported operation: ${params.action}`,
              params.action,
              { supportedOperations: ['sync', 'status'] },
              ['Use one of the supported operations: sync, status']
            );
        }
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        return OperationErrorHandler.createToolError(
          'EXECUTION_ERROR',
          `Failed to execute git-sync operation: ${errorMessage}`,
          params.action,
          { error: errorMessage }
        );
      }
    }
  • Tool schema definition for MCP registration, including input parameters like action (sync/status), projectPath, provider, remote, branch, etc.
    static getToolSchema() {
      return {
        name: 'git-sync',
        description: 'Advanced Git synchronization tool for intelligent sync and status operations. Supports both local Git synchronization and remote provider synchronization.',
        inputSchema: {
          type: 'object',
          properties: {
            action: {
              type: 'string',
              enum: ['sync', 'status'],
              description: 'The Git sync operation to perform'
            },
            projectPath: {
              type: 'string',
              description: 'Absolute path to the project directory'
            },
            provider: {
              type: 'string',
              enum: ['github', 'gitea', 'both'],
              description: 'Provider for remote operations (optional for local-only operations)'
            },
            remote: {
              type: 'string',
              description: 'Remote to sync with (default: origin)'
            },
            branch: {
              type: 'string',
              description: 'Branch to sync (default: current branch)'
            },
            strategy: {
              type: 'string',
              enum: ['merge', 'rebase', 'fast-forward'],
              description: 'Sync strategy (default: merge)'
            },
            force: {
              type: 'boolean',
              description: 'Force sync (use with caution, may override uncommitted changes)'
            },
            dryRun: {
              type: 'boolean',
              description: 'Show what would be done without executing (for sync operation)'
            },
            detailed: {
              type: 'boolean',
              description: 'Show detailed sync status (for status operation)'
            },
            includeRemote: {
              type: 'boolean',
              description: 'Include remote status information (for status operation)'
            },
            checkAhead: {
              type: 'boolean',
              description: 'Check commits ahead/behind (default: true for status operation)'
            },
            repo: {
              type: 'string',
              description: 'Repository name (auto-detected if not provided, for remote operations)'
            }
          },
          required: ['action', 'projectPath']
        }
      };
    }
  • src/server.ts:498-499 (registration)
    Registration and dispatch: server routes 'git-sync' calls to GitSyncTool.execute()
    case 'git-sync':
      return await this.gitSyncTool.execute(args);
  • src/server.ts:104-105 (registration)
    Tool instance initialization with provider config in server setup
    // Initialize git-sync with provider configuration (for remote sync)
    this.gitSyncTool = new GitSyncTool(providerConfig);
  • Parameter validation schema defining supported operations for git-sync: sync, status
    'git-sync': ['sync', 'status'],
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral disclosure. It mentions 'intelligent sync' without explaining what makes it intelligent, and doesn't cover important behavioral aspects like error handling, performance characteristics, authentication requirements, or what happens during sync operations (e.g., merge conflicts, data loss risks). The description is too high-level for a tool with 13 parameters.

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

Conciseness3/5

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

The description is reasonably concise with two sentences, but it's not particularly well-structured or front-loaded. The first sentence is somewhat marketing-oriented ('intelligent sync') rather than functional, and the second sentence adds scope information but could be more efficiently integrated. Every sentence earns its place but could be more effectively organized.

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 complexity (13 parameters, no annotations, no output schema), the description is inadequate. It doesn't explain what the tool returns, how sync operations work, what 'status' includes, or how local vs remote operations differ. For a multi-operation tool with many configuration options, this minimal description leaves too many questions unanswered for effective agent use.

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?

With 100% schema description coverage, the baseline is 3. The description doesn't add meaningful parameter semantics beyond what's already in the schema - it mentions 'local Git synchronization and remote provider synchronization' which loosely relates to some parameters but doesn't provide additional context about parameter interactions, dependencies, or usage patterns.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states it's a 'Git synchronization tool for intelligent sync and status operations' which provides a general purpose, but it's vague about what 'intelligent' means and doesn't clearly differentiate from sibling tools like git-remote or git-update. It mentions both local and remote synchronization but doesn't specify how this differs from other Git tools in the server.

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 explicit guidance on when to use this tool versus alternatives like git-remote or git-update. The description mentions it supports 'both local Git synchronization and remote provider synchronization' but doesn't provide context about when to choose this tool over other sibling tools that might handle similar operations.

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