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);
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'replicate and publish' but doesn't clarify if this is a read-only or destructive operation, what permissions are required, how errors are handled, or what the expected output is. This leaves significant gaps for a tool that likely involves content modification.

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

Conciseness4/5

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

The description is a single, concise sentence with no wasted words. It's front-loaded with the core action, making it easy to scan. However, it could be more structured by including key details without sacrificing brevity.

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 (3 parameters with nested objects, no output schema, and no annotations), the description is incomplete. It doesn't explain the tool's behavior, parameter details, or expected outcomes, leaving too much ambiguity for effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It only vaguely references 'selected locales' and 'content', without explaining what 'componentData' or 'localizedOverrides' mean, their formats, or examples. This fails to add meaningful context beyond the bare schema.

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 the tool's purpose as 'Replicate and publish content to selected locales', which includes a verb ('replicate and publish') and resource ('content'), but it's vague about what specific content is involved and doesn't distinguish it from sibling tools like 'publishContent' or 'bulkUpdateComponents'. It provides a basic purpose but lacks specificity.

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 guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, exclusions, or compare it to sibling tools such as 'publishContent' or 'bulkUpdateComponents'. Users must infer usage from the name alone.

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

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