Skip to main content
Glama

bulkUpdateComponents

Update multiple Adobe Experience Manager components simultaneously with built-in validation and rollback capabilities to maintain system integrity during batch operations.

Instructions

Update multiple components in a single operation with validation and rollback support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
updatesYes
validateFirstNo
continueOnErrorNo

Implementation Reference

  • Primary handler implementation for the bulkUpdateComponents tool. Handles validation phase (optional), performs sequential updates via updateComponent method, supports continueOnError, and returns comprehensive results with per-component status.
    async bulkUpdateComponents(request: BulkUpdateComponentsRequest): Promise<BulkUpdateResponse> {
      return safeExecute<BulkUpdateResponse>(async () => {
        const { updates, validateFirst = true, continueOnError = false } = request;
        
        if (!Array.isArray(updates) || updates.length === 0) {
          throw createAEMError(
            AEM_ERROR_CODES.INVALID_PARAMETERS, 
            'Updates array is required and cannot be empty'
          );
        }
    
        const results: Array<{
          componentPath: string;
          success: boolean;
          result?: unknown;
          error?: string;
          phase: string;
        }> = [];
    
        // Validation phase if requested
        if (validateFirst) {
          for (const update of updates) {
            try {
              await this.httpClient.get(`${update.componentPath}.json`);
            } catch (error: any) {
              if (error.response?.status === 404) {
                results.push({
                  componentPath: update.componentPath,
                  success: false,
                  error: `Component not found: ${update.componentPath}`,
                  phase: 'validation'
                });
                
                if (!continueOnError) {
                  return createSuccessResponse({
                    success: false,
                    message: 'Bulk update failed during validation phase',
                    results,
                    totalUpdates: updates.length,
                    successfulUpdates: 0
                  }, 'bulkUpdateComponents') as BulkUpdateResponse;
                }
              }
            }
          }
        }
    
        // Update phase
        let successCount = 0;
        for (const update of updates) {
          try {
            const result = await this.updateComponent({
              componentPath: update.componentPath,
              properties: update.properties
            });
            
            results.push({
              componentPath: update.componentPath,
              success: true,
              result: result,
              phase: 'update'
            });
            successCount++;
          } catch (error: any) {
            results.push({
              componentPath: update.componentPath,
              success: false,
              error: error.message,
              phase: 'update'
            });
            
            if (!continueOnError) {
              break;
            }
          }
        }
    
        return createSuccessResponse({
          success: successCount === updates.length,
          message: `Bulk update completed: ${successCount}/${updates.length} successful`,
          results,
          totalUpdates: updates.length,
          successfulUpdates: successCount,
          failedUpdates: updates.length - successCount
        }, 'bulkUpdateComponents') as BulkUpdateResponse;
      }, 'bulkUpdateComponents');
    }
  • JSON Schema definition and registration of the bulkUpdateComponents tool in the MCP server tools list, used for listTools request.
    {
      name: 'bulkUpdateComponents',
      description: 'Update multiple components in a single operation with validation and rollback support',
      inputSchema: {
        type: 'object',
        properties: {
          updates: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                componentPath: { type: 'string' },
                properties: { type: 'object' }
              },
              required: ['componentPath', 'properties']
            }
          },
          validateFirst: { type: 'boolean' },
          continueOnError: { type: 'boolean' }
        },
        required: ['updates'],
      },
    },
  • MCP server CallToolRequestSchema handler registration that invokes the bulkUpdateComponents method on the AEMConnector instance.
    case 'bulkUpdateComponents': {
      const result = await aemConnector.bulkUpdateComponents(args);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Delegation handler in AEMConnector class that forwards bulkUpdateComponents calls to the ComponentOperations module.
    async bulkUpdateComponents(request: any) {
      return this.componentOps.bulkUpdateComponents(request);
    }
  • Tool metadata listing in MCPRequestHandler's getAvailableMethods, providing description and parameters for bulkUpdateComponents.
        { name: 'bulkUpdateComponents', description: 'Update multiple components in a single operation with validation and rollback support', parameters: ['updates', 'validateFirst', 'continueOnError'] },
        { name: 'startWorkflow', description: 'Start a new workflow instance', parameters: ['model', 'payloadPath', 'title', 'comment'] },
        { name: 'listActiveWorkflows', description: 'List all currently running workflow instances', parameters: ['limit'] },
        { name: 'completeWorkflowStep', description: 'Complete a workflow step', parameters: ['workflowId', 'stepName', 'comment'] },
        { name: 'cancelWorkflow', description: 'Cancel a workflow instance', parameters: ['workflowId', 'reason'] },
        { name: 'suspendWorkflow', description: 'Suspend a workflow instance', parameters: ['workflowId', 'reason'] },
        { name: 'resumeWorkflow', description: 'Resume a suspended workflow instance', parameters: ['workflowId'] },
        { name: 'getWorkflowModels', description: 'Get all available workflow models', parameters: [] },
        { name: 'getVersionHistory', description: 'Get version history for a content path', parameters: ['path'] },
        { name: 'createVersion', description: 'Create a new version of content', parameters: ['path', 'label', 'comment'] },
        { name: 'restoreVersion', description: 'Restore content to a specific version', parameters: ['path', 'versionName'] },
        { name: 'compareVersions', description: 'Compare two versions of content', parameters: ['path', 'version1', 'version2'] },
        { name: 'deleteVersion', description: 'Delete a specific version', parameters: ['path', 'versionName'] },
      ];
    }

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/indrasishbanerjee/aem-mcp-server'

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