Skip to main content
Glama

deactivatePage

Unpublish a page in Adobe Experience Manager to remove it from public view. Optionally deactivate child pages in the hierarchy.

Instructions

Deactivate (unpublish) a single page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pagePathYes
deactivateTreeNo

Implementation Reference

  • Core handler function that performs the actual deactivation by calling AEM replication API with fallback methods.
    async deactivatePage(request: DeactivatePageRequest): Promise<DeactivateResponse> {
      return safeExecute<DeactivateResponse>(async () => {
        const { pagePath, deactivateTree = false } = request;
        
        if (!isValidContentPath(pagePath)) {
          throw createAEMError(
            AEM_ERROR_CODES.INVALID_PARAMETERS, 
            `Invalid page path: ${String(pagePath)}`, 
            { pagePath }
          );
        }
        
        try {
          // Use the correct AEM replication servlet endpoint
          const formData = new URLSearchParams();
          formData.append('cmd', 'Deactivate');
          formData.append('path', pagePath);
          formData.append('ignoredeactivated', 'false');
          formData.append('onlymodified', 'false');
          
          if (deactivateTree) {
            formData.append('deep', 'true');
          }
          
          const response = await this.httpClient.post('/bin/replicate.json', formData, {
            headers: {
              'Content-Type': 'application/x-www-form-urlencoded',
            },
          });
          
          return createSuccessResponse({
            success: true,
            deactivatedPath: pagePath,
            deactivateTree,
            response: response.data,
            timestamp: new Date().toISOString(),
          }, 'deactivatePage') as DeactivateResponse;
        } catch (error: any) {
          // Fallback to alternative replication methods
          try {
            const wcmResponse = await this.httpClient.post('/bin/wcmcommand', {
              cmd: 'deactivate',
              path: pagePath,
              ignoredeactivated: false,
              onlymodified: false,
            });
            
            return createSuccessResponse({
              success: true,
              deactivatedPath: pagePath,
              deactivateTree,
              response: wcmResponse.data,
              fallbackUsed: 'WCM Command',
              timestamp: new Date().toISOString(),
            }, 'deactivatePage') as DeactivateResponse;
          } catch (fallbackError: any) {
            throw handleAEMHttpError(error, 'deactivatePage');
          }
        }
      }, 'deactivatePage');
    }
  • MCP server dispatch handler that calls aemConnector.deactivatePage when the tool is invoked.
    case 'deactivatePage': {
      const result = await aemConnector.deactivatePage(args);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • MCP tool schema definition including input schema for deactivatePage.
    {
      name: 'deactivatePage',
      description: 'Deactivate (unpublish) a single page',
      inputSchema: {
        type: 'object',
        properties: {
          pagePath: { type: 'string' },
          deactivateTree: { type: 'boolean' },
        },
        required: ['pagePath'],
      },
    },
  • Intermediate handler dispatch in MCPRequestHandler.
    case 'deactivatePage':
      return await this.aemConnector.deactivatePage(params);
  • Wrapper method in AEMConnector that delegates to PageOperations.
    async deactivatePage(request: any) {
      return this.pageOps.deactivatePage(request);
    }

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