getPageImages
Extract all images from an Adobe Experience Manager page, including those within Experience Fragments, by providing the page path.
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 function that fetches the full page JSON structure using .infinity.json endpoint and recursively traverses all nodes to extract image references (fileReference or src properties), collecting path, fileReference, src, alt, and title for each image.async getPageImages(pagePath) { return safeExecute(async () => { const response = await this.httpClient.get(`${pagePath}.infinity.json`); const images = []; const processNode = (node, nodePath) => { 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'); }, 'getPageImages'); }
- dist/mcp-server.js:125-132 (registration)Tool registration in the MCP server tools array, including name, description, and input schema requiring pagePath.name: 'getPageImages', description: 'Get all images from a page, including those within Experience Fragments', inputSchema: { type: 'object', properties: { pagePath: { type: 'string' } }, required: ['pagePath'], }, },
- dist/mcp-handler.js:29-30 (handler)Dispatch handler in MCPRequestHandler that forwards getPageImages calls to the AEMConnector.case 'getPageImages': return await this.aemConnector.getPageImages(params.pagePath);
- dist/mcp-server.js:632-635 (handler)MCP server request handler case that extracts pagePath from args and calls aemConnector.getPageImages, returning JSON stringified result.case 'getPageImages': { const pagePath = args.pagePath; const result = await aemConnector.getPageImages(pagePath); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
- TypeScript interface definition for the getPageImages method signature and return type ImagesResponse.getPageImages(pagePath: string): Promise<ImagesResponse>;