Skip to main content
Glama

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
NameRequiredDescriptionDefault
pagePathYes

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'); }
  • 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'], }, },
  • Dispatch handler in MCPRequestHandler that forwards getPageImages calls to the AEMConnector.
    case 'getPageImages': return await this.aemConnector.getPageImages(params.pagePath);
  • 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>;

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