Skip to main content
Glama

bulk_action

Perform multiple Git operations in sequence on a repository using a single command. Stages files, commits changes, and pushes updates efficiently.

Instructions

Execute multiple Git operations in sequence. This is the preferred way to execute multiple operations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionsYesArray of Git operations to execute in sequence
pathNoPath to repository. MUST be an absolute path (e.g., /Users/username/projects/my-repo)

Implementation Reference

  • Core handler function that executes the bulk_action tool logic by iterating over the actions array and calling individual git operations (add/stage, commit, push) sequentially, collecting results or errors.
    static async executeBulkActions(options: BulkActionOptions, context: GitToolContext): Promise<GitToolResult> {
      const resolvedPath = this.getPath(options);
      return await this.executeOperation(
        context.operation,
        resolvedPath,
        async () => {
          const { path: repoPath } = PathValidator.validateGitRepo(resolvedPath);
          const results: string[] = [];
    
          for (const action of options.actions) {
            try {
              switch (action.type) {
                case 'stage': {
                  const files = action.files || ['.'];
                  const addResult = await this.add({ path: repoPath, files }, context);
                  results.push(addResult.content[0].text);
                  break;
                }
                case 'commit': {
                  const commitResult = await this.commit({ path: repoPath, message: action.message }, context);
                  results.push(commitResult.content[0].text);
                  break;
                }
                case 'push': {
                  const pushResult = await this.push({ 
                    path: repoPath, 
                    remote: action.remote, 
                    branch: action.branch 
                  }, context);
                  results.push(pushResult.content[0].text);
                  break;
                }
              }
            } catch (error: unknown) {
              const errorMessage = error instanceof Error ? error.message : 'Unknown error';
              results.push(`Failed to execute ${action.type}: ${errorMessage}`);
              if (error instanceof Error) {
                logger.error(context.operation, `Bulk action ${action.type} failed`, repoPath, error);
              }
            }
          }
    
          return {
            content: [{
              type: 'text',
              text: results.join('\n\n')
            }]
          };
        },
        {
          command: 'bulk_action',
          invalidateCache: true // Invalidate all caches
        }
      );
    }
  • MCP tool registration for 'bulk_action', including name, description, and detailed input schema defining the actions array with stage, commit, push variants.
    {
      name: 'bulk_action',
      description: 'Execute multiple Git operations in sequence. This is the preferred way to execute multiple operations.',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: `Path to repository. ${PATH_DESCRIPTION}`,
          },
          actions: {
            type: 'array',
            description: 'Array of Git operations to execute in sequence',
            items: {
              type: 'object',
              oneOf: [
                {
                  type: 'object',
                  properties: {
                    type: { const: 'stage' },
                    files: {
                      type: 'array',
                      items: {
                        type: 'string',
                        description: FILE_PATH_DESCRIPTION,
                      },
                      description: 'Files to stage. If not provided, stages all changes.',
                    },
                  },
                  required: ['type'],
                },
                {
                  type: 'object',
                  properties: {
                    type: { const: 'commit' },
                    message: {
                      type: 'string',
                      description: 'Commit message',
                    },
                  },
                  required: ['type', 'message'],
                },
                {
                  type: 'object',
                  properties: {
                    type: { const: 'push' },
                    remote: {
                      type: 'string',
                      description: 'Remote name',
                      default: 'origin',
                    },
                    branch: {
                      type: 'string',
                      description: 'Branch name',
                    },
                  },
                  required: ['type', 'branch'],
                },
              ],
            },
            minItems: 1,
          },
        },
        required: ['actions'],
      },
    },
  • TypeScript interfaces defining the structure of individual bulk actions (stage, commit, push) and the overall BulkActionOptions used by the tool.
    export interface BulkActionStage {
      type: 'stage';
      files?: string[]; // If not provided, stages all files
    }
    
    export interface BulkActionCommit {
      type: 'commit';
      message: string;
    }
    
    export interface BulkActionPush {
      type: 'push';
      remote?: string;
      branch: string;
    }
    
    export type BulkAction = BulkActionStage | BulkActionCommit | BulkActionPush;
    
    export interface BulkActionOptions extends GitOptions, BasePathOptions {
      actions: BulkAction[];
    }
  • Type guard function for validating BulkActionOptions inputs, ensuring path validity and correct structure for each action type.
    export function isBulkActionOptions(obj: any): obj is BulkActionOptions {
      if (!obj || !validatePath(obj.path) || !Array.isArray(obj.actions)) {
        return false;
      }
    
      return obj.actions.every((action: any) => {
        if (!action || typeof action.type !== 'string') {
          return false;
        }
    
        switch (action.type) {
          case 'stage':
            return !action.files || (Array.isArray(action.files) && 
              action.files.every((f: any) => typeof f === 'string' && isAbsolutePath(f)));
          case 'commit':
            return typeof action.message === 'string';
          case 'push':
            return typeof action.branch === 'string';
          default:
            return false;
        }
      });
    }
  • Tool executor switch case that validates arguments using isBulkActionOptions and delegates to GitOperations.executeBulkActions.
    case 'bulk_action': {
      const validArgs = this.validateArguments(operation, args, isBulkActionOptions);
      return await GitOperations.executeBulkActions(validArgs, context);
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions execution 'in sequence' and that it's 'preferred' for multiple operations, but lacks critical details: it doesn't specify error handling (e.g., whether failures stop the sequence), authentication needs, rate limits, or what happens if the repository path is invalid. For a tool that performs multiple Git operations, this is a significant gap in transparency.

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 appropriately sized and front-loaded: two concise sentences that directly state the purpose and usage guidance. Every sentence earns its place with zero waste, making it easy for an AI agent to parse quickly and understand the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (multiple Git operations), no annotations, and no output schema, the description is moderately complete but has gaps. It covers the high-level purpose and usage context but lacks behavioral details (e.g., error handling) and output expectations. For a tool with 2 parameters and rich nested actions in the schema, more context on execution behavior would improve completeness.

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 documents both parameters ('actions' and 'path') thoroughly. The description adds no additional parameter semantics beyond what's in the schema—it doesn't explain parameter interactions, constraints, or examples. Baseline 3 is appropriate when the schema does the heavy lifting, but the description doesn't compensate or add value here.

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: 'Execute multiple Git operations in sequence.' It specifies the verb ('execute') and resource ('Git operations'), though it doesn't explicitly distinguish from siblings like 'commit' or 'push' which handle single operations. The 'preferred way' phrase hints at differentiation but isn't specific about sibling relationships.

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

Usage Guidelines4/5

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

The description provides clear context for usage: 'This is the preferred way to execute multiple operations.' This implicitly guides when to use this tool (for multiple operations) versus alternatives (single-operation tools like 'commit' or 'push'), though it doesn't explicitly name alternatives or state when not to use it. The guidance is helpful but could be more explicit about sibling tool comparisons.

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

Related 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/Sheshiyer/git-mcp-v2'

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