Skip to main content
Glama

getAllTextContent

Extract all text content from an AEM page, including titles, text components, and descriptions, using a REST/JSON-RPC API for efficient content management and automation.

Instructions

Get all text content from a page including titles, text components, and descriptions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pagePathYes

Implementation Reference

  • Core handler implementation: Fetches the page's .infinity.json via HTTP, recursively processes the JCR node tree to extract all text content, titles (jcr:title), and descriptions (jcr:description), and returns a structured response.
    async getAllTextContent(pagePath) { return safeExecute(async () => { const response = await this.httpClient.get(`${pagePath}.infinity.json`); const textContent = []; const processNode = (node, nodePath) => { if (!node || typeof node !== 'object') return; if (node['text'] || node['jcr:title'] || node['jcr:description']) { textContent.push({ path: nodePath, title: node['jcr:title'], text: node['text'], description: node['jcr:description'], }); } 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, textContent, }, 'getAllTextContent'); }, 'getAllTextContent'); }
  • MCP tool registration in the server's tools array, including name, description, and input schema.
    name: 'getAllTextContent', description: 'Get all text content from a page including titles, text components, and descriptions', inputSchema: { type: 'object', properties: { pagePath: { type: 'string' } }, required: ['pagePath'], },
  • Top-level MCP server handler for the tool call: extracts pagePath from args and delegates to AEM connector, formats result for MCP response.
    case 'getAllTextContent': { const pagePath = args.pagePath; const result = await aemConnector.getAllTextContent(pagePath); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
  • JSON schema definition for the tool's input: requires a pagePath string.
    inputSchema: { type: 'object', properties: { pagePath: { type: 'string' } }, required: ['pagePath'], },
  • Delegate method in AEMConnector that forwards the call to pageOps (PageOperations instance).
    async getAllTextContent(pagePath) { return this.pageOps.getAllTextContent(pagePath);

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