fetchAvailableLocales
Retrieve available locales for a specific site and language master path using Adobe Experience Manager's MCP Server to manage multilingual content efficiently.
Instructions
Get available locales for a site and language master
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| languageMasterPath | Yes | ||
| site | Yes |
Implementation Reference
- Core handler function that executes the tool logic: fetches JSON from languageMasterPath with depth 2, filters out JCR/sling properties, extracts locale details (name, title, language) from child nodes, and returns a structured success response./** * Get available locales for a site and language master */ async fetchAvailableLocales(site, languageMasterPath) { return safeExecute(async () => { const response = await this.httpClient.get(`${languageMasterPath}.json`, { params: { ':depth': '2' } }); const locales = []; Object.entries(response.data).forEach(([key, value]) => { if (key.startsWith('jcr:') || key.startsWith('sling:')) return; if (value && typeof value === 'object') { locales.push({ name: key, title: value['jcr:content']?.['jcr:title'] || key, language: value['jcr:content']?.['jcr:language'] || key, }); } }); return createSuccessResponse({ site, languageMasterPath, availableLocales: locales, }, 'fetchAvailableLocales'); }, 'fetchAvailableLocales'); }
- dist/mcp-server.js:82-92 (schema)Tool schema definition including name, description, and inputSchema specifying required parameters: site (string) and languageMasterPath (string).name: 'fetchAvailableLocales', description: 'Get available locales for a site and language master', inputSchema: { type: 'object', properties: { site: { type: 'string' }, languageMasterPath: { type: 'string' }, }, required: ['site', 'languageMasterPath'], }, },
- dist/mcp-server.js:613-617 (registration)MCP server registration: handles CallToolRequest for 'fetchAvailableLocales' by extracting site and languageMasterPath from args, calling the AEM connector method, and returning JSON stringified result.case 'fetchAvailableLocales': { const { site, languageMasterPath } = args; const result = await aemConnector.fetchAvailableLocales(site, languageMasterPath); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- dist/aem-connector-new.js:172-173 (handler)Delegation handler in AEMConnector that forwards the call to the utilityOps module implementation.async fetchAvailableLocales(site, languageMasterPath) { return this.utilityOps.fetchAvailableLocales(site, languageMasterPath);
- dist/mcp-handler.js:21-22 (registration)Alternative dispatch/registration in MCPRequestHandler switch case that calls aemConnector.fetchAvailableLocales with extracted params.case 'fetchAvailableLocales': return await this.aemConnector.fetchAvailableLocales(params.site, params.languageMasterPath);