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
| Name | Required | Description | Default |
|---|---|---|---|
| cacheType | No | Specific cache type to clear (optional, clears all if not specified) |
Implementation Reference
- src/hybris-client.ts:691-716 (handler)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)', }, }, }, }, - src/index.ts:452-456 (handler)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;