getPageImages
Extract all images from a specified Adobe Experience Manager page, including those embedded within Experience Fragments, for efficient asset management and analysis.
Instructions
Get all images from a page, including those within Experience Fragments
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pagePath | Yes |
Implementation Reference
- Core handler implementation: Fetches full page content via .infinity.json and recursively traverses the JCR structure to extract all image references (fileReference, src properties) with metadata.async getPageImages(pagePath: string): Promise<ImagesResponse> { return safeExecute<ImagesResponse>(async () => { const response = await this.httpClient.get(`${pagePath}.infinity.json`); const images: Array<{ path: string; fileReference?: string; src?: string; alt?: string; title?: string; }> = []; const processNode = (node: any, nodePath: string) => { if (!node || typeof node !== 'object') return; if (node['fileReference'] || node['src']) { images.push({ path: nodePath, fileReference: node['fileReference'], src: node['src'], alt: node['alt'] || node['altText'], title: node['jcr:title'] || node['title'], }); } Object.entries(node).forEach(([key, value]) => { if (typeof value === 'object' && value !== null && !key.startsWith('rep:') && !key.startsWith('oak:')) { const childPath = nodePath ? `${nodePath}/${key}` : key; processNode(value, childPath); } }); }; if (response.data['jcr:content']) { processNode(response.data['jcr:content'], 'jcr:content'); } else { processNode(response.data, pagePath); } return createSuccessResponse({ pagePath, images, }, 'getPageImages') as ImagesResponse; }, 'getPageImages'); }
- src/mcp-server.ts:135-142 (registration)MCP tool registration including name, description, and input schema (requires pagePath: string).name: 'getPageImages', description: 'Get all images from a page, including those within Experience Fragments', inputSchema: { type: 'object', properties: { pagePath: { type: 'string' } }, required: ['pagePath'], }, },
- src/mcp-server.ts:644-648 (handler)Top-level MCP server handler that dispatches the tool call to AEMConnector.getPageImages.case 'getPageImages': { const pagePath = (args as { pagePath: string }).pagePath; const result = await aemConnector.getPageImages(pagePath); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/aem-connector-new.ts:115-611 (schema)Interface delegation in AEMConnector to pageOps.getPageImages.async getPageImages(pagePath: string) { return this.pageOps.getPageImages(pagePath); } // Component Operations async createComponent(request: any) { return this.componentOps.createComponent(request); } async updateComponent(request: any) { return this.componentOps.updateComponent(request); } async deleteComponent(request: any) { return this.componentOps.deleteComponent(request); } async validateComponent(request: any) { return this.componentOps.validateComponent(request); } async scanPageComponents(pagePath: string) { return this.componentOps.scanPageComponents(pagePath); } async bulkUpdateComponents(request: any) { return this.componentOps.bulkUpdateComponents(request); } async updateImagePath(componentPath: string, newImagePath: string) { return this.componentOps.updateImagePath(componentPath, newImagePath); } // Asset Operations async uploadAsset(request: any) { return this.assetOps.uploadAsset(request); } async updateAsset(request: any) { return this.assetOps.updateAsset(request); } async deleteAsset(request: any) { return this.assetOps.deleteAsset(request); } async getAssetMetadata(assetPath: string) { return this.assetOps.getAssetMetadata(assetPath); } // Search Operations async searchContent(params: any) { return this.searchOps.searchContent(params); } async executeJCRQuery(query: string, limit?: number) { return this.searchOps.executeJCRQuery(query, limit); } async enhancedPageSearch(params: any) { return this.searchOps.enhancedPageSearch(params); } // Template Operations async getTemplates(sitePath?: string) { return this.templateOps.getTemplates(sitePath); } async getTemplateStructure(templatePath: string) { return this.templateOps.getTemplateStructure(templatePath); } // Replication Operations async replicateAndPublish(selectedLocales: any, componentData: any, localizedOverrides?: any) { return this.replicationOps.replicateAndPublish(selectedLocales, componentData, localizedOverrides); } async unpublishContent(request: any) { return this.replicationOps.unpublishContent(request); } // Utility Operations async getNodeContent(path: string, depth?: number) { return this.utilityOps.getNodeContent(path, depth); } async listChildren(path: string) { return this.utilityOps.listChildren(path); } async fetchSites() { return this.utilityOps.fetchSites(); } async fetchLanguageMasters(site: string) { return this.utilityOps.fetchLanguageMasters(site); } async fetchAvailableLocales(site: string, languageMasterPath: string) { return this.utilityOps.fetchAvailableLocales(site, languageMasterPath); } // Additional methods for backward compatibility async createPageWithTemplate(request: any) { return this.createPage(request); } async getAvailableTemplates(parentPath: string) { return this.templateOps.getAvailableTemplates(parentPath); } async validateTemplate(templatePath: string, targetPath: string) { return this.templateOps.validateTemplate(templatePath, targetPath); } async getTemplateMetadata(templatePath: string, useCache = true) { return this.templateOps.getTemplateMetadata(templatePath, useCache); } clearTemplateCache(): void { this.templateOps.clearTemplateCache(); } // Workflow Operations async startWorkflow(request: any) { return this.workflowOps.startWorkflow(request); } async getWorkflowStatus(workflowId: string) { return this.workflowOps.getWorkflowStatus(workflowId); } async completeWorkflowStep(workflowId: string, stepName: string, comment?: string) { return this.workflowOps.completeWorkflowStep(workflowId, stepName, comment); } async cancelWorkflow(workflowId: string, reason?: string) { return this.workflowOps.cancelWorkflow(workflowId, reason); } async listActiveWorkflows(limit?: number) { return this.workflowOps.listActiveWorkflows(limit); } async suspendWorkflow(workflowId: string, reason?: string) { return this.workflowOps.suspendWorkflow(workflowId, reason); } async resumeWorkflow(workflowId: string) { return this.workflowOps.resumeWorkflow(workflowId); } async getWorkflowModels() { return this.workflowOps.getWorkflowModels(); } // Version Operations async getVersionHistory(path: string) { return this.versionOps.getVersionHistory(path); } async createVersion(path: string, label?: string, comment?: string) { return this.versionOps.createVersion(path, label, comment); } async restoreVersion(path: string, versionName: string) { return this.versionOps.restoreVersion(path, versionName); } async compareVersions(path: string, version1: string, version2: string) { return this.versionOps.compareVersions(path, version1, version2); } async deleteVersion(path: string, versionName: string) { return this.versionOps.deleteVersion(path, versionName); } async undoChanges(request: any) { return this.versionOps.undoChanges(request); } }
- src/interfaces/index.ts:661-663 (schema)Type definition for the response structure containing pagePath and array of image objects.export interface ImagesResponse extends BaseResponse { data: { pagePath: string;