Skip to main content
Glama

updateImagePath

Modify image component paths in Adobe Experience Manager to update visual content and verify changes for accurate asset display.

Instructions

Update the image path for an image component and verify the update

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentPathYes
newImagePathYes

Implementation Reference

  • Primary MCP server tool handler: extracts parameters from tool call arguments and invokes the AEM connector's updateImagePath method, returning the JSON-stringified result.
    case 'updateImagePath': {
        const { componentPath, newImagePath } = args;
        const result = await aemConnector.updateImagePath(componentPath, newImagePath);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Tool registration object defining the tool name, description, and input schema, included in the tools array returned by ListToolsRequestHandler.
        name: 'updateImagePath',
        description: 'Update the image path for an image component and verify the update',
        inputSchema: {
            type: 'object',
            properties: {
                componentPath: { type: 'string' },
                newImagePath: { type: 'string' },
            },
            required: ['componentPath', 'newImagePath'],
        },
    },
  • Input schema defining parameters for the updateImagePath tool: componentPath (string, required) and newImagePath (string, required).
        inputSchema: {
            type: 'object',
            properties: {
                componentPath: { type: 'string' },
                newImagePath: { type: 'string' },
            },
            required: ['componentPath', 'newImagePath'],
        },
    },
  • Helper method in ComponentOperations that maps updateImagePath to a generic updateComponent call, setting the fileReference property.
     */
    async updateImagePath(componentPath, newImagePath) {
        return this.updateComponent({
            componentPath,
            properties: { fileReference: newImagePath }
        });
    }
  • Core handler logic for updating component properties via AEM HTTP API: validates path, constructs form data from properties, performs POST update, verifies with GET, wraps in safeExecute.
    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');
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'update' and 'verify' but doesn't specify what verification entails, whether this is a destructive operation, what permissions are required, error handling, or what happens if the component doesn't exist. For a mutation tool with zero annotation coverage, this is insufficient behavioral context.

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

Conciseness4/5

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

The description is concise with a single sentence that states the core functionality. It's front-loaded with the primary action ('update') and includes the verification aspect. While efficient, it could potentially be more structured with separate purpose and behavior statements.

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?

For a mutation tool with 2 parameters, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't explain what verification means, what format the paths should be in, what happens on success/failure, or how this differs from other update operations. The context demands more comprehensive documentation.

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 'componentPath' and 'newImagePath' implicitly but provides no details about format, constraints, or what these parameters represent. The description adds minimal semantic value beyond what can be inferred from parameter names alone.

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 tool's purpose with a specific verb ('update') and resource ('image path for an image component'), and mentions verification. It distinguishes from generic 'updateComponent' by focusing specifically on image paths. However, it doesn't explicitly differentiate from other image-related tools like 'getPageImages' or 'updateAsset'.

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?

The description provides no guidance on when to use this tool versus alternatives like 'updateComponent' or 'updateAsset'. It mentions verification but doesn't specify prerequisites, error conditions, or when this specific tool is preferred over more general update tools. No explicit when/when-not statements are present.

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