Skip to main content
Glama

enhancedPageSearch

Search Adobe Experience Manager pages using intelligent queries with fallback strategies and cross-section search capabilities.

Instructions

Intelligent page search with comprehensive fallback strategies and cross-section search

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchTermYes
basePathYes
includeAlternateLocalesNo

Implementation Reference

  • Core handler implementing enhancedPageSearch with fallback strategies: fulltext, title, description searches, and optional cross-locale search using AEM QueryBuilder.
    async enhancedPageSearch(params: EnhancedSearchParams): Promise<SearchResponse> {
      return safeExecute<SearchResponse>(async () => {
        const { searchTerm, basePath, includeAlternateLocales } = params;
        
        // Try multiple search strategies
        const searchStrategies = [
          // Strategy 1: Direct fulltext search
          () => this.searchContent({
            fulltext: searchTerm,
            path: basePath,
            type: 'cq:Page',
            limit: 20
          }),
          
          // Strategy 2: Search by title
          () => this.searchContent({
            'property': 'jcr:title',
            'property.value': searchTerm,
            'property.operation': 'like',
            path: basePath,
            type: 'cq:Page',
            limit: 20
          } as any),
          
          // Strategy 3: Search by description
          () => this.searchContent({
            'property': 'jcr:description',
            'property.value': searchTerm,
            'property.operation': 'like',
            path: basePath,
            type: 'cq:Page',
            limit: 20
          } as any)
        ];
    
        // If includeAlternateLocales is true, add locale-specific searches
        if (includeAlternateLocales) {
          searchStrategies.push(
            // Strategy 4: Search in all locales
            () => this.searchContent({
              fulltext: searchTerm,
              path: basePath.replace(/\/[a-z]{2}(-[A-Z]{2})?$/, ''),
              type: 'cq:Page',
              limit: 20
            })
          );
        }
    
        // Try each strategy until one succeeds
        let lastError: any;
        for (const strategy of searchStrategies) {
          try {
            const result = await strategy();
            if (result.data.results && result.data.results.length > 0) {
              return createSuccessResponse({
                params: {
                  searchTerm,
                  basePath,
                  includeAlternateLocales,
                  strategy: 'enhanced'
                },
                results: result.data.results,
                total: result.data.total,
                searchStrategies: searchStrategies.length
              }, 'enhancedPageSearch') as SearchResponse;
            }
          } catch (error) {
            lastError = error;
            this.logger.warn('Search strategy failed', {
              error: error instanceof Error ? error.message : String(error),
              searchTerm,
              basePath
            });
          }
        }
    
        // If all strategies failed, return empty results
        this.logger.warn('All search strategies failed', {
          searchTerm,
          basePath,
          lastError: lastError instanceof Error ? lastError.message : String(lastError)
        });
    
        return createSuccessResponse({
          params: {
            searchTerm,
            basePath,
            includeAlternateLocales,
            strategy: 'enhanced'
          },
          results: [],
          total: 0,
          searchStrategies: searchStrategies.length,
          allStrategiesFailed: true
        }, 'enhancedPageSearch') as SearchResponse;
      }, 'enhancedPageSearch');
    }
  • MCP tool schema definition specifying input parameters for enhancedPageSearch.
    {
      name: 'enhancedPageSearch',
      description: 'Intelligent page search with comprehensive fallback strategies and cross-section search',
      inputSchema: {
        type: 'object',
        properties: {
          searchTerm: { type: 'string' },
          basePath: { type: 'string' },
          includeAlternateLocales: { type: 'boolean' },
        },
        required: ['searchTerm', 'basePath'],
      },
    },
  • Registration of tool list handler that exposes enhancedPageSearch in the tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • MCP server tool call handler dispatching to AEM connector's enhancedPageSearch.
    case 'enhancedPageSearch': {
      const result = await aemConnector.enhancedPageSearch(args);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
  • Internal MCP request handler switch case calling enhancedPageSearch.
    case 'enhancedPageSearch':
      return await this.aemConnector.enhancedPageSearch(params);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It hints at 'fallback strategies' and 'cross-section search' but doesn't explain what these entail (e.g., error handling, performance, or search scope). Critical details like permissions, rate limits, or output format are missing, leaving significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with a single sentence that front-loads key terms like 'intelligent page search'. However, it could be more structured by explicitly separating purpose from features, but it avoids unnecessary verbosity and gets straight to the point without wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity implied by 'intelligent' search and 3 parameters with 0% schema coverage, the description is incomplete. No output schema exists, and it doesn't explain return values or error handling. For a search tool with multiple parameters and no annotations, more detail on behavior and results is needed to be adequately helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate but fails to do so. It doesn't mention any parameters or their meanings, leaving 'searchTerm', 'basePath', and 'includeAlternateLocales' entirely undocumented. This lack of semantic context makes it hard for users to understand what inputs are needed or how they affect the search.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool performs 'intelligent page search' with 'comprehensive fallback strategies and cross-section search', which gives a general purpose but lacks specificity about what resources it searches (pages vs other content) or what 'intelligent' means operationally. It doesn't clearly distinguish from sibling tools like 'searchContent' or 'listPages', leaving ambiguity about when to choose this over alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance is provided on when to use this tool versus alternatives like 'searchContent' or 'listPages'. The mention of 'fallback strategies' and 'cross-section search' implies some context but doesn't specify scenarios, prerequisites, or exclusions. Users must infer usage from vague terms without concrete direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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