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');

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