Skip to main content
Glama
elgentos

Magento 2 Development MCP Server

by elgentos

Cache Flush

cache-flush

Flush specific Magento 2 cache types or clear all caches to resolve caching issues and ensure updated content displays correctly.

Instructions

Flush specific Magento 2 cache types or all caches

Input Schema

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

Implementation Reference

  • The handler function that executes the `magerun2 cache:flush` command, handling optional cache types input, running the command via executeMagerun2Command, and returning formatted success or error responses.
    async ({ types }) => {
      const cacheTypesArg = types && types.length > 0 ? types.join(' ') : '';
      const command = `magerun2 cache:flush ${cacheTypesArg}`.trim();
      const result = await executeMagerun2Command(command);
    
      if (!result.success) {
        return {
          content: [{
            type: "text",
            text: result.error
          }],
          isError: result.isError
        };
      }
    
      return {
        content: [{
          type: "text",
          text: `Cache flush completed:\n\n${result.data}`
        }]
      };
    }
  • Input schema defining optional array of cache types to flush using Zod validation.
    inputSchema: {
      types: z.array(z.string())
        .optional()
        .describe("Specific cache types to flush (leave empty for all caches)")
    }
  • src/index.ts:187-220 (registration)
    Registration of the 'cache-flush' tool with server.registerTool, including title, description, input schema, and inline handler function.
    server.registerTool(
      "cache-flush",
      {
        title: "Cache Flush",
        description: "Flush specific Magento 2 cache types or all caches",
        inputSchema: {
          types: z.array(z.string())
            .optional()
            .describe("Specific cache types to flush (leave empty for all caches)")
        }
      },
      async ({ types }) => {
        const cacheTypesArg = types && types.length > 0 ? types.join(' ') : '';
        const command = `magerun2 cache:flush ${cacheTypesArg}`.trim();
        const result = await executeMagerun2Command(command);
    
        if (!result.success) {
          return {
            content: [{
              type: "text",
              text: result.error
            }],
            isError: result.isError
          };
        }
    
        return {
          content: [{
            type: "text",
            text: `Cache flush completed:\n\n${result.data}`
          }]
        };
      }
    );
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. It states the action ('Flush') but does not disclose behavioral traits like whether this requires admin permissions, if it's destructive to system performance, potential side effects, or error handling. This is a significant gap for a mutation tool with zero annotation coverage.

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 waste. It is appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

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 management tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects, usage context, and potential impacts, making it inadequate for safe and effective agent invocation.

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, clearly explaining the 'types' parameter. The description adds no additional meaning beyond what the schema provides, such as examples of cache types or usage nuances. Baseline 3 is appropriate when the schema does the heavy lifting.

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 verb ('Flush') and resource ('Magento 2 cache types or all caches'), making the purpose unambiguous. However, it does not explicitly differentiate from sibling tools like 'cache-clean' or 'cache-disable', which might have overlapping or related functionality, so it falls short of a perfect score.

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 'cache-clean' or 'cache-disable'. It lacks context on prerequisites, exclusions, or specific scenarios, leaving the agent to infer usage from the tool name alone.

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