Skip to main content
Glama

unpublishContent

Remove content from the publish environment in Adobe Experience Manager. Specify content paths to unpublish individual items or entire trees.

Instructions

Unpublish content from the publish environment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentPathsYes
unpublishTreeNo

Implementation Reference

  • Core handler function that performs the unpublishing by sending POST requests to AEM's /bin/replicate.json with cmd=Deactivate for each content path, handling multiple paths and tree option.
    async unpublishContent(request: UnpublishContentRequest): Promise<UnpublishResponse> { return safeExecute<UnpublishResponse>(async () => { const { contentPaths, unpublishTree = false } = request; if (!contentPaths || (Array.isArray(contentPaths) && contentPaths.length === 0)) { throw createAEMError( AEM_ERROR_CODES.INVALID_PARAMETERS, 'Content paths array is required and cannot be empty', { contentPaths } ); } const results: Array<{ path: string; success: boolean; response?: unknown; error?: unknown; }> = []; // Process each path individually using the correct AEM replication API for (const path of Array.isArray(contentPaths) ? contentPaths : [contentPaths]) { try { // Use the correct AEM replication servlet endpoint const formData = new URLSearchParams(); formData.append('cmd', 'Deactivate'); formData.append('path', path); formData.append('ignoredeactivated', 'false'); formData.append('onlymodified', 'false'); if (unpublishTree) { formData.append('deep', 'true'); } const response = await this.httpClient.post('/bin/replicate.json', formData, { headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, }); results.push({ path, success: true, response: response.data }); } catch (error: any) { results.push({ path, success: false, error: error.response?.data || error.message }); } } return createSuccessResponse({ success: results.every(r => r.success), results, unpublishedPaths: contentPaths, unpublishTree, timestamp: new Date().toISOString(), }, 'unpublishContent') as UnpublishResponse; }, 'unpublishContent'); }
  • MCP server top-level handler that receives tool calls for unpublishContent and delegates to AEMConnector.
    case 'unpublishContent': { const result = await aemConnector.unpublishContent(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
  • JSON schema defining the input parameters for the unpublishContent tool (contentPaths array required, unpublishTree optional boolean).
    { name: 'unpublishContent', description: 'Unpublish content from the publish environment', inputSchema: { type: 'object', properties: { contentPaths: { type: 'array', items: { type: 'string' } }, unpublishTree: { type: 'boolean' }, }, required: ['contentPaths'], }, },
  • Registration of the listTools handler that returns the tools array including unpublishContent.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
  • Delegation from AEMConnector to ReplicationOperations.unpublishContent.
    async unpublishContent(request: any) { return this.replicationOps.unpublishContent(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