Skip to main content
Glama
elgentos

Magento 2 Development MCP Server

by elgentos

Cache Status

cache-status

Check Magento 2 cache type status to identify enabled/disabled caches and troubleshoot performance issues during development.

Instructions

Check the status of Magento 2 cache types

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the core logic of the 'cache-status' tool. It runs the 'magerun2 cache:status' command via the executeMagerun2Command helper, handles success/error cases, and returns formatted text content with the cache status.
    async () => {
      const command = `magerun2 cache:status`;
      const result = await executeMagerun2Command(command);
    
      if (!result.success) {
        return {
          content: [{
            type: "text",
            text: result.error
          }],
          isError: result.isError
        };
      }
    
      return {
        content: [{
          type: "text",
          text: `Cache status:\n\n${result.data}`
        }]
      };
    }
  • src/index.ts:305-333 (registration)
    The registration of the 'cache-status' tool with the MCP server, specifying the tool name, title, description, empty input schema, and inline handler function.
    server.registerTool(
      "cache-status",
      {
        title: "Cache Status",
        description: "Check the status of Magento 2 cache types",
        inputSchema: {}
      },
      async () => {
        const command = `magerun2 cache:status`;
        const result = await executeMagerun2Command(command);
    
        if (!result.success) {
          return {
            content: [{
              type: "text",
              text: result.error
            }],
            isError: result.isError
          };
        }
    
        return {
          content: [{
            type: "text",
            text: `Cache status:\n\n${result.data}`
          }]
        };
      }
    );
  • Shared helper utility function that executes magerun2 CLI commands safely, handles timeouts, stderr, JSON parsing, and provides user-friendly error messages for missing magerun2 or non-Magento directories. Used by 'cache-status' and all other tools.
    async function executeMagerun2Command(command: string, parseJson: boolean = false): Promise<{
      success: true;
      data: any;
      rawOutput: string;
    } | {
      success: false;
      error: string;
      isError: true;
    }> {
      try {
        const { stdout, stderr } = await execAsync(command, {
          cwd: process.cwd(),
          timeout: 30000 // 30 second timeout
        });
    
        if (stderr && stderr.trim()) {
          console.error("magerun2 stderr:", stderr);
        }
    
        if (parseJson) {
          try {
            return { success: true, data: JSON.parse(stdout), rawOutput: stdout };
          } catch (parseError) {
            return {
              success: false,
              error: `Error parsing magerun2 JSON output: ${parseError}\n\nRaw output:\n${stdout}`,
              isError: true
            };
          }
        }
    
        return { success: true, data: stdout.trim(), rawOutput: stdout };
    
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
    
        // Check if magerun2 is not found
        if (errorMessage.includes("command not found") || errorMessage.includes("not recognized")) {
          return {
            success: false,
            error: "Error: magerun2 command not found. Please ensure n98-magerun2 is installed and available in your PATH.\n\nInstallation instructions: https://github.com/netz98/n98-magerun2",
            isError: true
          };
        }
    
        // Check if not in Magento directory
        if (errorMessage.includes("not a Magento installation") || errorMessage.includes("app/etc/env.php")) {
          return {
            success: false,
            error: "Error: Current directory does not appear to be a Magento 2 installation. Please run this command from your Magento 2 root directory.",
            isError: true
          };
        }
    
        return {
          success: false,
          error: `Error executing magerun2 command: ${errorMessage}`,
          isError: true
        };
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Check' suggests a read-only operation, it doesn't explicitly state whether this requires specific permissions, what format the status information returns, whether it's real-time or cached data, or any rate limits. For a diagnostic tool with zero annotation coverage, this represents significant behavioral gaps.

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 communicates the essential purpose without any wasted words. It's appropriately sized for a simple diagnostic tool and front-loads the core functionality. Every word earns its place in this minimal but complete statement.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no parameters, no annotations, no output schema), the description provides adequate coverage of what the tool does. However, as a diagnostic tool with potential complexity in what 'status' means and how it's presented, the description could benefit from clarifying the return format or what specific status information is provided. It meets minimum viability but leaves questions about output format.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and schema description coverage is 100% (though trivial since there are no parameters). The description appropriately doesn't discuss parameters since none exist. A baseline of 4 is appropriate for parameterless tools where the schema fully documents the empty parameter set.

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 ('Check') and resource ('status of Magento 2 cache types'), making the purpose immediately understandable. It distinguishes itself from siblings like cache-clean, cache-disable, cache-enable, cache-flush, and cache-view by focusing on status checking rather than modification operations. However, it doesn't explicitly contrast with cache-view which might also provide status information, preventing 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 Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through the verb 'Check' - suggesting this is for diagnostic or monitoring purposes rather than modification. However, it provides no explicit guidance on when to use this tool versus alternatives like cache-view or sys-info, nor does it mention prerequisites or exclusions. The context is implied but not articulated.

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