Skip to main content
Glama

updateComponent

Modify component properties in Adobe Experience Manager to adjust content behavior and appearance for dynamic web experiences.

Instructions

Update component properties in AEM

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentPathYes
propertiesYes

Implementation Reference

  • Core implementation of the updateComponent tool. Validates input parameters, verifies component existence, constructs form data from properties handling arrays/objects/nulls, performs HTTP POST to update the component in AEM, fetches updated component for verification, and returns detailed success response.
    async updateComponent(request) {
        return safeExecute(async () => {
            const { componentPath, properties } = request;
            if (!componentPath || typeof componentPath !== 'string') {
                throw createAEMError(AEM_ERROR_CODES.INVALID_PARAMETERS, 'Component path is required and must be a string');
            }
            if (!properties || typeof properties !== 'object') {
                throw createAEMError(AEM_ERROR_CODES.INVALID_PARAMETERS, 'Properties are required and must be an object');
            }
            if (!isValidContentPath(componentPath)) {
                throw createAEMError(AEM_ERROR_CODES.INVALID_PATH, `Component path '${componentPath}' is not within allowed content roots`, {
                    path: componentPath,
                    allowedRoots: Object.values(this.config.contentPaths)
                });
            }
            // Verify component exists
            try {
                await this.httpClient.get(`${componentPath}.json`);
            }
            catch (error) {
                if (error.response?.status === 404) {
                    throw createAEMError(AEM_ERROR_CODES.COMPONENT_NOT_FOUND, `Component not found at path: ${componentPath}`, { componentPath });
                }
                throw handleAEMHttpError(error, 'updateComponent');
            }
            // Prepare form data for AEM
            const formData = new URLSearchParams();
            Object.entries(properties).forEach(([key, value]) => {
                if (value === null || value === undefined) {
                    formData.append(`${key}@Delete`, '');
                }
                else if (Array.isArray(value)) {
                    value.forEach((item) => {
                        formData.append(`${key}`, item.toString());
                    });
                }
                else if (typeof value === 'object') {
                    formData.append(key, JSON.stringify(value));
                }
                else {
                    formData.append(key, value.toString());
                }
            });
            // Update the component
            const response = await this.httpClient.post(componentPath, formData, {
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                    'Accept': 'application/json',
                },
                timeout: this.config.queries.timeoutMs,
            });
            // Verify the update
            const verificationResponse = await this.httpClient.get(`${componentPath}.json`);
            return createSuccessResponse({
                message: 'Component updated successfully',
                path: componentPath,
                properties,
                updatedProperties: verificationResponse.data,
                response: response.data,
                verification: {
                    success: true,
                    propertiesChanged: Object.keys(properties).length,
                    timestamp: new Date().toISOString(),
                },
            }, 'updateComponent');
        }, 'updateComponent');
  • Tool dispatch registration in MCPRequestHandler.handleRequest switch statement. Routes 'updateComponent' calls to the AEMConnector instance.
    case 'updateComponent':
        return await this.aemConnector.updateComponent(params);
  • Tool metadata and schema definition in getAvailableMethods(), specifying name, description, and expected input parameters (componentPath, properties).
    { name: 'updateComponent', description: 'Update component properties in AEM', parameters: ['componentPath', 'properties'] },
  • Proxy/delegation method in AEMConnector class that forwards updateComponent requests to the specialized ComponentOperations module.
    async updateComponent(request) {
        return this.componentOps.updateComponent(request);
  • Initialization of ComponentOperations instance in AEMConnector constructor, providing httpClient, logger, and AEM config for the updateComponent handler.
    this.componentOps = new ComponentOperations(this.httpClient, this.logger, config.aem);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Update' implying a mutation, but doesn't mention permissions, side effects, reversibility, or response format. This is inadequate for a mutation tool with zero annotation coverage.

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 resource, making it easy to parse quickly.

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 complexity (mutation with 2 parameters, nested objects, no output schema, and no annotations), the description is insufficient. It lacks details on behavior, parameters, and output, failing to provide a complete picture 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 mentions 'component properties' but doesn't explain what 'componentPath' or 'properties' entail, their formats, or constraints, adding minimal value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and resource ('component properties in AEM'), making the purpose understandable. However, it doesn't distinguish this from sibling tools like 'bulkUpdateComponents' or 'updateAsset', which would require more specificity about scope or target.

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 'bulkUpdateComponents' or 'createComponent'. The description lacks context about prerequisites, typical scenarios, or exclusions, leaving usage unclear.

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