Skip to main content
Glama

replicateAndPublish

Distribute content to multiple locales by replicating and publishing component data with localized overrides in Adobe Experience Manager.

Instructions

Replicate and publish content to selected locales

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectedLocalesYes
componentDataYes
localizedOverridesNo

Implementation Reference

  • Core implementation of the replicateAndPublish tool logic. Handles multi-locale replication to AEM, supports MSM (Multi-Site Manager) structures, performs content activation via replication APIs, includes comprehensive error handling with optional rollback on failures.
    async replicateAndPublish( selectedLocales: string[], componentData: unknown, localizedOverrides?: unknown ): Promise<ReplicateResponse> { return safeExecute<ReplicateResponse>(async () => { if (!selectedLocales || selectedLocales.length === 0) { throw createAEMError( AEM_ERROR_CODES.INVALID_PARAMETERS, 'selectedLocales array is required and cannot be empty', { selectedLocales } ); } const results: Array<{ locale: string; success: boolean; message: string; path?: string; error?: string; replicationId?: string; }> = []; const successfulReplications: string[] = []; let hasFailures = false; for (const locale of selectedLocales) { try { this.logger.info(`Starting replication to locale: ${locale}`, { componentData: typeof componentData, hasOverrides: !!localizedOverrides }); // Step 1: Validate locale path exists const localePath = this.validateAndBuildLocalePath(locale); // Step 2: Check if content is part of MSM structure const isMSMContent = await this.checkMSMStructure(localePath); let replicationResult: any; if (isMSMContent) { // Step 3a: Use MSM APIs for live copy updates replicationResult = await this.handleMSMReplication( localePath, componentData, localizedOverrides ); } else { // Step 3b: Standard replication process replicationResult = await this.handleStandardReplication( localePath, componentData, localizedOverrides ); } // Step 4: Activate content in the target locale await this.activateContentInLocale(localePath); results.push({ locale, success: true, message: `Content replicated and activated successfully to ${locale}`, path: localePath, replicationId: replicationResult.replicationId }); successfulReplications.push(locale); this.logger.info(`Content replicated successfully to locale: ${locale}`, { path: localePath, replicationId: replicationResult.replicationId }); } catch (error: any) { hasFailures = true; results.push({ locale, success: false, message: `Failed to replicate to ${locale}: ${error.message}`, error: error.message }); this.logger.error(`Failed to replicate to locale: ${locale}`, { error: error.message, stack: error.stack }); // If we have a strict policy, rollback successful replications if (this.config.strictReplication) { await this.rollbackSuccessfulReplications(successfulReplications); } } } return createSuccessResponse({ message: hasFailures ? `Replication completed with errors. ${successfulReplications.length}/${selectedLocales.length} locales successful.` : 'All replications completed successfully', selectedLocales, successfulLocales: successfulReplications, failedLocales: results.filter(r => !r.success).map(r => r.locale), componentData, localizedOverrides, results, success: !hasFailures, summary: { total: selectedLocales.length, successful: successfulReplications.length, failed: selectedLocales.length - successfulReplications.length } }, 'replicateAndPublish') as ReplicateResponse; }, 'replicateAndPublish'); }
  • MCP server CallToolRequest handler for 'replicateAndPublish' tool. Receives MCP tool call parameters and delegates execution to AEMConnector.replicateAndPublish, formats response as MCP content.
    case 'replicateAndPublish': { const result = await aemConnector.replicateAndPublish(args.selectedLocales, args.componentData, args.localizedOverrides); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
  • JSON schema definition for the replicateAndPublish MCP tool input parameters, used for tool registration and validation.
    { name: 'replicateAndPublish', description: 'Replicate and publish content to selected locales', inputSchema: { type: 'object', properties: { selectedLocales: { type: 'array', items: { type: 'string' } }, componentData: { type: 'object' }, localizedOverrides: { type: 'object' }, }, required: ['selectedLocales', 'componentData'], }, },
  • MCP server registration of tool list handler. Returns the complete list of available tools including replicateAndPublish schema for ListTools requests.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
  • Delegation method in AEMConnector that routes replicateAndPublish calls to the ReplicationOperations module.
    async replicateAndPublish(selectedLocales: any, componentData: any, localizedOverrides?: any) { return this.replicationOps.replicateAndPublish(selectedLocales, componentData, localizedOverrides); }

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