Skip to main content
Glama

fetchAvailableLocales

Retrieve available locales for a specific site and language master to manage multilingual content in Adobe Experience Manager.

Instructions

Get available locales for a site and language master

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteYes
languageMasterPathYes

Implementation Reference

  • Core implementation of the fetchAvailableLocales tool logic. Queries the languageMasterPath .json endpoint with depth 2, parses child nodes (skipping jcr/sling prefixed), extracts locales with name, title, language, and wraps in success response.
    async fetchAvailableLocales(site: string, languageMasterPath: string): Promise<LocalesResponse> {
      return safeExecute<LocalesResponse>(async () => {
        const response = await this.httpClient.get(`${languageMasterPath}.json`, { 
          params: { ':depth': '2' } 
        });
        
        const locales: Array<{
          name: string;
          title: string;
          language: string;
        }> = [];
    
        Object.entries(response.data).forEach(([key, value]: [string, any]) => {
          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') as LocalesResponse;
      }, 'fetchAvailableLocales');
    }
  • MCP tool registration entry defining name, description, and input schema (object with required string properties 'site' and 'languageMasterPath').
    {
      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'],
      },
    },
  • MCP server request handler dispatch case for 'fetchAvailableLocales' that extracts params from args and invokes aemConnector.fetchAvailableLocales.
    case 'fetchAvailableLocales': {
      const { site, languageMasterPath } = args as { site: string; languageMasterPath: string };
      const result = await aemConnector.fetchAvailableLocales(site, languageMasterPath);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • TypeScript interface defining the output structure LocalesResponse for fetchAvailableLocales, extending BaseResponse with site, languageMasterPath, and array of locales (name, title, language).
    export interface LocalesResponse extends BaseResponse {
      data: {
        site: string;
        languageMasterPath: string;
        availableLocales: Array<{
          name: string;
          title: string;
          language: string;
        }>;
      };
    }
  • Delegation wrapper in AEMConnector class that forwards fetchAvailableLocales call to the underlying utilityOps instance.
    async fetchAvailableLocales(site: string, languageMasterPath: string) {
      return this.utilityOps.fetchAvailableLocales(site, languageMasterPath);
    }

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