Skip to main content
Glama

clear_cache

Remove cached data from SAP Commerce Cloud (Hybris) to resolve performance issues or outdated information. Specify a cache type or clear all caches.

Instructions

Clear the Hybris cache

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cacheTypeNoSpecific cache type to clear (optional, clears all if not specified)

Implementation Reference

  • The actual implementation of the clearCache method which executes a Groovy script on the Hybris platform.
      async clearCache(cacheType?: string): Promise<{ success: boolean; message: string }> {
        // Use Groovy script to clear cache
        const escapedType = cacheType ? this.escapeGroovyString(cacheType) : '';
        const script = `
    import de.hybris.platform.core.Registry
    
    def cacheType = "${escapedType}"
    
    if (cacheType == "all" || cacheType == "") {
        Registry.getCurrentTenant().getCache().clear()
        println "All caches cleared"
        return "SUCCESS"
    } else {
        // Clear specific cache region if supported
        try {
            def cacheController = spring.getBean("cacheController")
            cacheController.clearCache()
            println "Cache cleared: " + cacheType
            return "SUCCESS"
        } catch (Exception e) {
            Registry.getCurrentTenant().getCache().clear()
            println "Cleared all caches (specific cache type not supported)"
            return "SUCCESS"
        }
    }
    `;
  • src/index.ts:280-292 (registration)
    The MCP tool registration definition for clear_cache.
    {
      name: 'clear_cache',
      description: 'Clear the Hybris cache',
      inputSchema: {
        type: 'object',
        properties: {
          cacheType: {
            type: 'string',
            description: 'Specific cache type to clear (optional, clears all if not specified)',
          },
        },
      },
    },
  • The handler logic in the tool router that invokes the hybrisClient.clearCache method.
    case 'clear_cache':
      result = await hybrisClient.clearCache(
        validateString(args, 'cacheType', false)
      );
      break;

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/mcieunic/hybris-mcp-main'

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