fetchSites
Retrieve all available sites in Adobe Experience Manager to manage content, components, and assets through REST/JSON-RPC APIs.
Instructions
Get all available sites in AEM
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Core handler implementation for fetchSites tool. Queries AEM /content.json endpoint with depth=2, parses top-level sites, extracts name, path, title, template, and lastModified properties, wraps in standardized response.async fetchSites(): Promise<SitesResponse> { return safeExecute<SitesResponse>(async () => { const response = await this.httpClient.get('/content.json', { params: { ':depth': '2' } }); const sites: Array<{ name: string; path: string; title: string; template?: string; lastModified?: string; }> = []; Object.entries(response.data).forEach(([key, value]: [string, any]) => { if (key.startsWith('jcr:') || key.startsWith('sling:')) return; if (value && typeof value === 'object' && value['jcr:content']) { sites.push({ name: key, path: `/content/${key}`, title: value['jcr:content']['jcr:title'] || key, template: value['jcr:content']['cq:template'], lastModified: value['jcr:content']['cq:lastModified'], }); } }); return createSuccessResponse({ sites, totalCount: sites.length, }, 'fetchSites') as SitesResponse; }, 'fetchSites'); }
- src/interfaces/index.ts:548-559 (schema)Type definition for the output response of fetchSites, defining the structure of sites array and totalCount.export interface SitesResponse extends BaseResponse { data: { sites: Array<{ name: string; path: string; title: string; template?: string; lastModified?: string; }>; totalCount: number; }; }
- src/mcp-server.ts:77-81 (schema)MCP tool schema definition including name, description, and empty input schema (no parameters required).{ name: 'fetchSites', description: 'Get all available sites in AEM', inputSchema: { type: 'object', properties: {} }, },
- src/mcp-server.ts:616-619 (registration)MCP server dispatch handler for fetchSites tool call, invoking AEM connector and returning JSON response.case 'fetchSites': { const result = await aemConnector.fetchSites(); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/mcp-handler.ts:124-124 (registration)Alternative handler registration listing fetchSites in available methods with description and no parameters.{ name: 'fetchSites', description: 'Get all available sites in AEM', parameters: [] },