Skip to main content
Glama
Emenowicz

Hybris MCP Server

by Emenowicz

clear_cache

Clear cache in SAP Commerce Cloud (Hybris) to resolve data display issues by removing outdated cached content, with optional targeting of specific cache types.

Instructions

Clear the Hybris cache

Input Schema

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

Implementation Reference

  • Primary handler implementation for clearing Hybris cache using a Groovy script that invokes cacheController.clearCache() or general cache clear.
      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"
        }
    }
    `;
        const result = await this.executeGroovyScript(script);
        const output = result.output || '';
        const execResult = String(result.result || '');
        const success = output.includes('cleared') || execResult === 'SUCCESS';
        return {
          success,
          message: success ? 'Cache cleared successfully' : `Failed to clear cache: ${output || execResult || 'Unknown error'}`,
        };
      }
  • MCP tool call handler dispatch for 'clear_cache', validates input and calls hybrisClient.clearCache()
    case 'clear_cache':
      result = await hybrisClient.clearCache(
        validateString(args, 'cacheType', false)
      );
      break;
  • Tool definition including name, description, and input schema for 'clear_cache' used for registration and validation
    {
      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:359-361 (registration)
    Registration of the tools list handler, which exposes the clear_cache tool via ListToolsRequest
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • Direct call to Hybris cacheController.clearCache() within the Groovy script for specific cache clearing.
    def cacheController = spring.getBean("cacheController")
    cacheController.clearCache()
Behavior2/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. While 'Clear' implies a destructive mutation, it doesn't specify whether this requires admin permissions, if it's reversible, what side effects occur (e.g., performance impact), or if it affects all users. For a mutation tool with zero annotation coverage, this is a significant gap in safety and operational context.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero wasted words, front-loading the core action and resource. It's appropriately sized for a simple tool with one optional parameter, making it easy for an agent to parse quickly.

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?

Given the tool's complexity (a destructive cache-clearing operation) and the lack of annotations and output schema, the description is incomplete. It doesn't cover behavioral traits like permissions needed, system impact, or what to expect after execution, which are critical for safe and effective use by an AI agent.

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%, with the parameter 'cacheType' well-documented in the schema as optional for clearing specific caches or all if unspecified. The description adds no additional parameter semantics beyond what the schema provides, but since the schema is comprehensive, the baseline score of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the action ('Clear') and the target resource ('the Hybris cache'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'trigger_catalog_sync' or 'execute_groovy' that might also affect system state, leaving room for ambiguity about when to choose this specific cache-clearing operation.

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?

The description provides no guidance on when to use this tool versus alternatives, such as whether it's for debugging, performance tuning, or after configuration changes. It doesn't mention prerequisites, risks, or related tools like 'get_system_info' for checking cache status, leaving the agent with minimal context for decision-making.

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

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