Skip to main content
Glama
elgentos

Magento 2 Development MCP Server

by elgentos

Cache Clean

cache-clean

Clear specific Magento 2 cache types or all caches to resolve performance issues and ensure updated content displays correctly.

Instructions

Clear specific Magento 2 cache types or all caches

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typesNoSpecific cache types to clean (leave empty for all caches)

Implementation Reference

  • The handler function for the 'cache-clean' tool. It takes optional cache types, constructs the 'magerun2 cache:clean' command, executes it using executeMagerun2Command, and returns success/error response with output.
      async ({ types }) => {
        const cacheTypesArg = types && types.length > 0 ? types.join(' ') : '';
        const command = `magerun2 cache:clean ${cacheTypesArg}`.trim();
        const result = await executeMagerun2Command(command);
    
        if (!result.success) {
          return {
            content: [{
              type: "text",
              text: result.error
            }],
            isError: true
          };
        }
    
        return {
          content: [{
            type: "text",
            text: `Cache clean completed:\n\n${result.data}`
          }]
        };
      }
    );
  • Input schema for the 'cache-clean' tool defining an optional array of strings for specific cache types.
    inputSchema: {
      types: z.array(z.string())
        .optional()
        .describe("Specific cache types to clean (leave empty for all caches)")
    }
  • src/index.ts:147-180 (registration)
    Registration of the 'cache-clean' tool with server.registerTool, including title, description, schema, and inline handler function.
    server.registerTool(
      "cache-clean",
      {
        title: "Cache Clean",
        description: "Clear specific Magento 2 cache types or all caches",
        inputSchema: {
          types: z.array(z.string())
            .optional()
            .describe("Specific cache types to clean (leave empty for all caches)")
        }
      },
      async ({ types }) => {
        const cacheTypesArg = types && types.length > 0 ? types.join(' ') : '';
        const command = `magerun2 cache:clean ${cacheTypesArg}`.trim();
        const result = await executeMagerun2Command(command);
    
        if (!result.success) {
          return {
            content: [{
              type: "text",
              text: result.error
            }],
            isError: true
          };
        }
    
        return {
          content: [{
            type: "text",
            text: `Cache clean completed:\n\n${result.data}`
          }]
        };
      }
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the action ('Clear') but does not specify whether this requires admin permissions, if it's destructive to system performance, what the typical response or errors might be, or any rate limits. This leaves significant gaps in understanding the tool's behavior.

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 that directly states the tool's function without unnecessary words. It is front-loaded and appropriately sized for its purpose, with no wasted information.

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 complexity of a cache-clearing operation in a system like Magento 2, with no annotations and no output schema, the description is insufficient. It lacks details on permissions, side effects, error handling, or what happens after execution, making it incomplete 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?

The input schema has 100% description coverage, with the 'types' parameter well-documented. The description adds minimal value by implying the parameter's purpose ('specific cache types' vs 'all caches'), but does not provide additional semantics beyond what the schema already states, 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.

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 target ('Magento 2 cache types or all caches'), making the purpose evident. However, it does not explicitly differentiate from sibling tools like cache-flush or cache-disable, which might have overlapping or distinct functionality, leaving some ambiguity.

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 such as cache-flush or cache-disable, nor are any prerequisites or exclusions mentioned. The description only states what the tool does, not when it should be selected over other cache-related tools.

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/elgentos/magento2-dev-mcp'

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