Skip to main content
Glama

aem_clear_cache

Clear Adobe Experience Manager caches to resolve content display issues and ensure updated content appears correctly by removing cached dispatcher, clientlibs, or all cache types.

Instructions

Clear various AEM caches

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cacheTypeNoType of cache to clearall
hostNoAEM host (default: localhost)localhost
portNoAEM port (default: 4502)
usernameNoAEM username (default: admin)admin
passwordNoAEM password (default: admin)admin

Implementation Reference

  • Handler function in AEMTools class that processes tool arguments, calls AEMClient.clearCache, formats the result into MCP content response.
      async clearCache(args: any) {
        const config = this.getConfig(args);
        const { cacheType = 'all' } = args;
    
        const result = await this.aemClient.clearCache(config, cacheType);
        
        let cacheText = `Cache Clear Result:
    Cache Type: ${cacheType}
    Success: ${result.success}
    `;
    
        if (result.success && result.results) {
          cacheText += `\nResults:\n`;
          result.results.forEach((res: any) => {
            cacheText += `- ${res.type}: ${res.success ? 'Success' : 'Failed'} - ${res.message}\n`;
          });
        } else {
          cacheText += `Message: Failed to clear cache`;
        }
        
        return {
          content: [
            {
              type: 'text',
              text: cacheText,
            },
          ],
        };
      }
  • Core helper method in AEMClient that executes HTTP POST requests to clear clientlibs cache and/or invalidate dispatcher cache based on the specified cacheType.
    async clearCache(config: AEMConfig, cacheType: string = 'all'): Promise<any> {
      const baseUrl = this.getBaseUrl(config);
      const authHeader = this.getAuthHeader(config);
    
      const results: any[] = [];
    
      try {
        if (cacheType === 'clientlibs' || cacheType === 'all') {
          // Clear client libraries cache
          const clientlibsResponse = await this.axiosInstance.post(
            `${baseUrl}/libs/granite/ui/content/dumplibs.rebuild.html`,
            {},
            {
              headers: {
                'Authorization': authHeader,
              },
            }
          );
          
          results.push({
            type: 'clientlibs',
            success: clientlibsResponse.status === 200,
            message: clientlibsResponse.status === 200 ? 'Client libraries cache cleared' : 'Failed to clear client libraries cache',
          });
        }
    
        if (cacheType === 'dispatcher' || cacheType === 'all') {
          // Invalidate dispatcher cache (if available)
          try {
            const dispatcherResponse = await this.axiosInstance.post(
              `${baseUrl}/dispatcher/invalidate.cache`,
              {},
              {
                headers: {
                  'Authorization': authHeader,
                },
              }
            );
            
            results.push({
              type: 'dispatcher',
              success: dispatcherResponse.status === 200,
              message: dispatcherResponse.status === 200 ? 'Dispatcher cache invalidated' : 'Failed to invalidate dispatcher cache',
            });
          } catch (error) {
            results.push({
              type: 'dispatcher',
              success: false,
              message: 'Dispatcher cache invalidation not available or failed',
            });
          }
        }
    
        return {
          success: true,
          results: results,
        };
      } catch (error) {
        throw new Error(`Cache clearing failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • Input schema definition for the aem_clear_cache tool, specifying parameters like cacheType, host, port, credentials.
    inputSchema: {
      type: 'object',
      properties: {
        cacheType: {
          type: 'string',
          description: 'Type of cache to clear',
          enum: ['dispatcher', 'clientlibs', 'all'],
          default: 'all'
        },
        host: {
          type: 'string',
          description: 'AEM host (default: localhost)',
          default: 'localhost'
        },
        port: {
          type: 'number',
          description: 'AEM port (default: 4502)',
          default: 4502
        },
        username: {
          type: 'string',
          description: 'AEM username (default: admin)',
          default: 'admin'
        },
        password: {
          type: 'string',
          description: 'AEM password (default: admin)',
          default: 'admin'
        }
      }
    }
  • src/index.ts:367-368 (registration)
    Registration of the tool handler in the CallToolRequest switch statement in index.ts.
    case 'aem_clear_cache':
      return await this.aemTools.clearCache(args);
  • src/index.ts:309-343 (registration)
    Tool registration entry in the listTools response, including name, description, and schema.
    {
      name: 'aem_clear_cache',
      description: 'Clear various AEM caches',
      inputSchema: {
        type: 'object',
        properties: {
          cacheType: {
            type: 'string',
            description: 'Type of cache to clear',
            enum: ['dispatcher', 'clientlibs', 'all'],
            default: 'all'
          },
          host: {
            type: 'string',
            description: 'AEM host (default: localhost)',
            default: 'localhost'
          },
          port: {
            type: 'number',
            description: 'AEM port (default: 4502)',
            default: 4502
          },
          username: {
            type: 'string',
            description: 'AEM username (default: admin)',
            default: 'admin'
          },
          password: {
            type: 'string',
            description: 'AEM password (default: admin)',
            default: 'admin'
          }
        }
      }
    }
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without disclosing behavioral traits. It doesn't mention authentication needs (implied by username/password params), potential destructive effects, rate limits, or response format, leaving critical operational context unspecified.

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 a single, efficient sentence with no wasted words, making it front-loaded and easy to parse. However, it could be more structured by explicitly listing cache types or adding brief context.

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?

For a tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover authentication, side effects, or return values, failing to compensate for the lack of structured data, which is inadequate given the tool's complexity.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description adds no meaning beyond the schema, as it doesn't explain parameter interactions or provide additional context, meeting the baseline for high schema coverage.

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 'Clear various AEM caches' states the action (clear) and resource (AEM caches), but it's vague about scope and doesn't differentiate from siblings like aem_replicate_content or aem_status. It lacks specificity about what 'various' entails compared to the cacheType parameter options.

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 guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites, timing, or sibling tools, leaving the agent to infer usage from context alone without explicit 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/pradeep-moolemane/aem-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server