Skip to main content
Glama

executeJCRQuery

Execute queries on Adobe Experience Manager's Java Content Repository to retrieve content, components, or assets using JCR syntax.

Instructions

Execute JCR query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Implementation Reference

  • Core handler function that executes the JCR query via AEM QueryBuilder API, with input validation and security checks.
    async executeJCRQuery(query: string, limit = 20): Promise<JCRQueryResponse> {
      return safeExecute<JCRQueryResponse>(async () => {
        if (!query || typeof query !== 'string' || query.trim().length === 0) {
          throw new Error('Query is required and must be a non-empty string. Note: Only QueryBuilder fulltext is supported, not JCR SQL2.');
        }
        
        // Basic security validation
        const lower = query.toLowerCase();
        if (/drop|delete|update|insert|exec|script|\.|<script/i.test(lower) || query.length > 1000) {
          throw new Error('Query contains potentially unsafe patterns or is too long');
        }
    
        const response = await this.httpClient.get('/bin/querybuilder.json', {
          params: {
            path: '/content',
            type: 'cq:Page',
            fulltext: query,
            'p.limit': limit
          }
        });
    
        return {
          query,
          results: response.data.hits || [],
          total: response.data.total || 0,
          limit
        };
      }, 'executeJCRQuery');
    }
  • MCP server tool call handler that extracts parameters and delegates to AEM connector.
    case 'executeJCRQuery': {
      const { query, limit } = args as { query: string; limit: number };
      const result = await aemConnector.executeJCRQuery(query, limit);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Input schema definition for the executeJCRQuery tool, specifying query (required) and optional limit.
    {
      name: 'executeJCRQuery',
      description: 'Execute JCR query',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string' },
          limit: { type: 'number' },
        },
        required: ['query'],
      },
    },
  • Registration of the tools list handler, which exposes executeJCRQuery in the MCP tools list.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • Delegation handler in AEMConnector that forwards the call to SearchOperations module.
    async executeJCRQuery(query: string, limit?: number) {
      return this.searchOps.executeJCRQuery(query, limit);
    }
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Execute JCR query' gives no information about whether this is a read or write operation, what permissions are required, whether it has side effects, rate limits, error conditions, or what the output looks like. For a tool with two parameters and no output schema, this is critically inadequate.

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

Conciseness3/5

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

The description is extremely concise at three words, which could be appropriate if it were more informative. However, it's under-specified rather than efficiently structured—it doesn't front-load critical information or provide any meaningful elaboration. While not verbose, it lacks substance, making this a borderline case between conciseness and insufficiency.

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

Completeness1/5

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

Given the complexity implied by the tool name (JCR queries can be complex), two parameters with 0% schema coverage, no annotations, and no output schema, the description is completely inadequate. It doesn't explain what the tool does beyond the name, how to use it, what it returns, or how it fits with siblings. This leaves the agent with insufficient information to use the tool correctly.

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

Parameters1/5

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

Schema description coverage is 0%, meaning neither parameter ('query' and 'limit') has any documentation in the schema. The description adds no information about what these parameters mean, what format the query should be in, what query language is used, what the limit applies to, or default values. With two undocumented parameters, the description fails to compensate for the schema gap.

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

Purpose2/5

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

The description 'Execute JCR query' is essentially a tautology that restates the tool name with minimal elaboration. While it indicates the tool performs query execution (verb) on JCR resources, it lacks specificity about what JCR queries are, what they return, or how this differs from sibling tools like 'searchContent' or 'enhancedPageSearch'. The purpose is vague and doesn't distinguish from alternatives.

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

Usage Guidelines1/5

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

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'searchContent', 'enhancedPageSearch', and 'getAllTextContent' that might overlap in functionality, there is no indication of when this specific JCR query tool is appropriate, what prerequisites exist, or when other tools should be preferred. This leaves the agent with no usage context.

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