Skip to main content
Glama

deleteComponent

Remove components from Adobe Experience Manager using the component path, with an optional force parameter for deletion.

Instructions

Delete a component from AEM

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentPathYes
forceNo

Implementation Reference

  • Core implementation of deleteComponent: performs HTTP DELETE on componentPath, falls back to POST with :operation=delete if 405, with validation and error handling.
    async deleteComponent(request: DeleteComponentRequest): Promise<DeleteResponse> {
      return safeExecute<DeleteResponse>(async () => {
        const { componentPath, force = false } = request;
        
        if (!isValidContentPath(componentPath)) {
          throw createAEMError(
            AEM_ERROR_CODES.INVALID_PARAMETERS, 
            `Invalid component path: ${String(componentPath)}`, 
            { componentPath }
          );
        }
    
        let deleted = false;
        try {
          await this.httpClient.delete(componentPath);
          deleted = true;
        } catch (err: any) {
          if (err.response && err.response.status === 405) {
            try {
              await this.httpClient.post(componentPath, { ':operation': 'delete' });
              deleted = true;
            } catch (slingErr: any) {
              this.logger.error('Sling POST delete failed', {
                error: slingErr.response?.status,
                data: slingErr.response?.data
              });
              throw slingErr;
            }
          } else {
            this.logger.error('DELETE failed', {
              status: err.response?.status,
              data: err.response?.data
            });
            throw err;
          }
        }
    
        return createSuccessResponse({
          success: deleted,
          deletedPath: componentPath,
          timestamp: new Date().toISOString(),
        }, 'deleteComponent') as DeleteResponse;
      }, 'deleteComponent');
    }
  • MCP tool registration including name, description, and input schema for deleteComponent.
      name: 'deleteComponent',
      description: 'Delete a component from AEM',
      inputSchema: {
        type: 'object',
        properties: {
          componentPath: { type: 'string' },
          force: { type: 'boolean' },
        },
        required: ['componentPath'],
      },
    },
  • MCP server dispatch handler that calls aemConnector.deleteComponent on tool invocation.
    case 'deleteComponent': {
      const result = await aemConnector.deleteComponent(args);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Wrapper in AEMConnector that delegates deleteComponent to ComponentOperations instance.
    async deleteComponent(request: any) {
      return this.componentOps.deleteComponent(request);
    }
  • TypeScript interface imports for DeleteComponentRequest and DeleteResponse used in the handler.
    CreateComponentRequest,
    UpdateComponentRequest,
    DeleteComponentRequest,
    ValidateComponentRequest,
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the action without disclosing behavioral traits. It doesn't mention permissions required, irreversible effects, error handling, or side effects, which is inadequate for a destructive operation.

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, direct sentence with no wasted words, making it highly concise and front-loaded. It efficiently conveys the core action without unnecessary elaboration.

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 tool's destructive nature, no annotations, no output schema, and low schema coverage, the description is incomplete. It fails to address critical aspects like safety, return values, or error conditions, making it insufficient for informed 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 but adds no parameter details. It doesn't explain what 'componentPath' represents or the effect of the 'force' parameter, leaving both parameters semantically unclear.

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 ('Delete') and target resource ('a component from AEM'), which is clear but vague. It doesn't specify what type of component or distinguish it from similar deletion tools like deleteAsset or deletePage, leaving ambiguity about scope.

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 like deleteAsset or deletePage, nor any prerequisites or exclusions. The description lacks context for selection among sibling tools, offering minimal usage direction.

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