getPageTextContent
Extract text content from Adobe Experience Manager pages to retrieve and analyze textual information for content management and automation workflows.
Instructions
Get text content from a specific page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pagePath | Yes |
Implementation Reference
- src/mcp-server.ts:639-642 (handler)Primary MCP tool handler for getPageTextContent. Extracts pagePath from tool arguments, calls AEMConnector.getPageTextContent, and returns the JSON-stringified result as MCP content response.case 'getPageTextContent': { const pagePath = (args as { pagePath: string }).pagePath; const result = await aemConnector.getPageTextContent(pagePath); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
- src/mcp-server.ts:126-132 (schema)MCP tool registration including name, description, and input schema requiring 'pagePath' string parameter.name: 'getPageTextContent', description: 'Get text content from a specific page', inputSchema: { type: 'object', properties: { pagePath: { type: 'string' } }, required: ['pagePath'], },
- Core implementation logic for extracting text content. Fetches page .infinity.json, recursively processes nodes for text, jcr:title, jcr:description fields, and returns structured TextContentResponse.async getAllTextContent(pagePath: string): Promise<TextContentResponse> { return safeExecute<TextContentResponse>(async () => { const response = await this.httpClient.get(`${pagePath}.infinity.json`); const textContent: Array<{ path: string; title?: string; text?: string; description?: string; }> = []; const processNode = (node: any, nodePath: string) => { 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') as TextContentResponse; }, 'getAllTextContent'); }
- Alias method in PageOperations that delegates getPageTextContent to getAllTextContent.async getPageTextContent(pagePath: string): Promise<TextContentResponse> { return this.getAllTextContent(pagePath); }
- src/aem-connector-new.ts:111-113 (helper)Delegation method in AEMConnector that forwards getPageTextContent call to the pageOps (PageOperations) module.async getPageTextContent(pagePath: string) { return this.pageOps.getPageTextContent(pagePath); }
- src/interfaces/index.ts:649-659 (schema)TypeScript interface defining the expected response structure for getPageTextContent, including pagePath and array of text content items with path, title, text, description.export interface TextContentResponse extends BaseResponse { data: { pagePath: string; textContent: Array<{ path: string; title?: string; text?: string; description?: string; }>; }; }