Skip to main content
Glama

executeJCRQuery

Run JCR queries to retrieve specific content or data from Adobe Experience Manager using this tool. Supports query execution with optional result limits for efficient content management.

Instructions

Execute JCR query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes

Implementation Reference

  • Core handler implementation: Executes QueryBuilder fulltext search on cq:Page nodes under /content with input validation, security checks against SQL injection patterns, and error handling via safeExecute.
    async executeJCRQuery(query, limit = 20) { return safeExecute(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 tool registration: Defines the tool name, description, and input schema (query required string, optional limit number) for the Model Context Protocol server.
    { name: 'executeJCRQuery', description: 'Execute JCR query', inputSchema: { type: 'object', properties: { query: { type: 'string' }, limit: { type: 'number' }, }, required: ['query'], }, },
  • Top-level MCP request handler dispatch: Extracts parameters and calls AEMConnector.executeJCRQuery, formats result as MCP response.
    case 'executeJCRQuery': { const { query, limit } = args; const result = await aemConnector.executeJCRQuery(query, limit); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
  • TypeScript interface definition for executeJCRQuery method signature.
    executeJCRQuery(query: string, limit?: number): Promise<import("./interfaces/index.js").JCRQueryResponse>;
  • Delegation from AEMConnector to SearchOperations module.
    async executeJCRQuery(query, limit) { return this.searchOps.executeJCRQuery(query, limit);

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