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);
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 'unpublish', implying a mutation that removes content from a publish environment, but doesn't specify permissions required, whether it's destructive or reversible, rate limits, or what happens to the unpublished content (e.g., moved to draft, deleted). This leaves critical behavioral traits unclear for a mutation tool.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core action and target, making it easy to parse quickly. Every part of the sentence contributes directly to the tool's purpose, achieving optimal conciseness.

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 of a mutation tool with no annotations, 2 parameters at 0% schema coverage, and no output schema, the description is incomplete. It lacks details on behavior, parameters, return values, and how it fits with sibling tools. For a tool that likely alters content state, this minimal description is insufficient for safe and effective use.

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 adds no meaning beyond the schema: it doesn't explain what 'contentPaths' are (e.g., file paths, URLs, identifiers) or what 'unpublishTree' does (e.g., unpublish nested content). With 2 parameters and no schema descriptions, the description fails to provide necessary semantic context.

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 action ('unpublish') and target ('content from the publish environment'), which is clear but vague. It doesn't specify what 'content' refers to (e.g., pages, assets, components) or how it differs from sibling tools like 'deactivatePage' or 'deletePage', which might have overlapping purposes. The purpose is understandable but lacks specificity and differentiation.

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. For example, it doesn't clarify if 'unpublish' is reversible, if it's for removing content from a live site versus archiving, or how it relates to tools like 'deactivatePage' or 'deletePage'. The description offers no context or exclusions, leaving usage ambiguous.

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