The AEM MCP Server provides two powerful bulk operations for managing components across AEM pages: bulkUpdateComponents and bulkConvertComponents. These tools enable efficient batch processing of component updates and conversions with built-in validation and error handling.
Updates multiple components across different pages in a single operation with validation and error handling support.
-
Validation Phase (optional, enabled by default):
- Verifies all component paths exist before processing
- If
validateFirst=trueand a component is not found, the operation can either:- Stop immediately if
continueOnError=false - Continue with remaining components if
continueOnError=true
- Stop immediately if
-
Update Phase:
- Iterates through each component in the
updatesarray - Calls
updateComponentfor each component with its specified properties - Tracks success/failure for each update
- Stops on first error if
continueOnError=false, otherwise continues processing
- Iterates through each component in the
-
Response:
- Returns summary with total updates, successful updates, and failed updates
- Includes detailed results for each component update attempt
- updates (required): Array of objects with:
componentPath: Full path to the component (e.g.,/content/site/en/page/jcr:content/root/container/component_123)properties: Object containing properties to update
- validateFirst (optional, default:
true): Validate component existence before updating - continueOnError (optional, default:
false): Continue processing remaining components if one fails
Update text content across multiple components on different pages:
{
"updates": [
{
"componentPath": "/content/site/en/page1/jcr:content/root/container/text1",
"properties": { "text": "Updated content 1" }
},
{
"componentPath": "/content/site/en/page2/jcr:content/root/container/text2",
"properties": { "text": "Updated content 2" }
}
],
"validateFirst": true,
"continueOnError": true
}Converts components of one type to another type across multiple pages. Finds all matching source components, deletes them, and creates new target components at the same location.
-
Page Discovery:
- Option A: Uses provided
pagePathsarray for specific pages - Option B: Uses
searchPathto find all pages under a path (with optionaldepthandlimit)
- Option A: Uses provided
-
Component Conversion (per page):
- Scans each page for components matching
sourceResourceType - For each matching component:
- Validates target component requirements (checks
cq:dialogandsling:resourceSuperType) - Deletes the source component
- Creates new target component at the same path with:
- Same
jcr:primaryType - New
sling:resourceType - Required properties from
requiredPropertiesparameter
- Same
- Validates target component requirements (checks
- Preserves component location and parent structure
- Scans each page for components matching
-
Error Handling:
- If
continueOnError=true: Continues processing remaining pages even if one fails - If
continueOnError=false: Stops on first page error - Returns detailed results per page with component counts
- If
-
Response:
- Summary of pages processed, succeeded, and failed
- Total components found, converted, and failed
- Per-page breakdown of conversion results
- sourceResourceType (required): Resource type to find and convert (e.g.,
foundation/components/text) - targetResourceType (required): Resource type to convert to (e.g.,
aemmcp/base/components/aemmcp-text/v1/aemmcp-text) - pagePaths (optional): Array of specific page paths to process
- searchPath (optional): Base path to search for pages (alternative to
pagePaths) - depth (optional, default:
2): Depth to search when usingsearchPath - limit (optional, default:
50): Maximum pages to process when usingsearchPath - requiredProperties (optional): Object with required property values for target component
- continueOnError (optional, default:
true): Continue processing pages even if some fail
Convert all legacy text components to new component type across a site section:
{
"sourceResourceType": "foundation/components/text",
"targetResourceType": "aemmcp/base/components/aemmcp-text/v1/aemmcp-text",
"searchPath": "/content/mysite/en",
"depth": 3,
"limit": 100,
"requiredProperties": {
"text": "Migrated from legacy component"
},
"continueOnError": true
}- Automatic Property Validation: Checks target component's
cq:dialogandsling:resourceSuperTypeto identify required properties - Location Preservation: Maintains exact component location and hierarchy
- Bulk Processing: Handles multiple pages efficiently with progress tracking
- Error Resilience: Configurable error handling to balance safety vs. completion
| Feature | bulkUpdateComponents | bulkConvertComponents |
|---|---|---|
| Operation | Updates properties | Changes component type |
| Scope | Specific component paths | Components across pages |
| Discovery | Manual (provide paths) | Automatic (scan pages) |
| Component Deletion | No | Yes (replaced) |
| Component Creation | No | Yes (new type) |
| Use Case | Property updates | Component migration |
- Always use
validateFirst=trueforbulkUpdateComponentsto catch invalid paths early - Use
continueOnError=truefor large bulk operations to maximize completion - Test on a small subset before running bulk operations on production
- Provide
requiredPropertiesforbulkConvertComponentswhen target components have mandatory fields - Monitor response results to identify any failed operations for manual review