Skip to main content
Glama
elgentos

Magento 2 Development MCP Server

by elgentos

cache-view

View specific cache entries in Magento 2 to inspect stored data and troubleshoot caching issues by providing the cache key.

Instructions

Inspect specific cache entries in Magento 2

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesCache key to inspect
typeNoCache type (optional)

Implementation Reference

  • Handler function that runs the `magerun2 cache:view` command to inspect the specified cache entry, handling input parameters 'key' and optional 'type', executing the command via the shared executeMagerun2Command helper, and formatting the response.
        const typeArg = type ? `--type=${type}` : '';
        const command = `magerun2 cache:view ${typeArg} "${key}"`.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 entry for key "${key}":\n\n${result.data}`
          }]
        };
      }
    );
  • Schema definition for the cache-view tool, including title, description, and Zod input schema requiring a 'key' string and optional 'type' string.
      title: "Cache View",
      description: "Inspect specific cache entries in Magento 2",
      inputSchema: {
        key: z.string()
          .describe("Cache key to inspect"),
        type: z.string()
          .optional()
          .describe("Cache type (optional)")
      }
    },
    async ({ key, type }) => {
  • src/index.ts:341-375 (registration)
    Full registration of the 'cache-view' MCP tool using server.registerTool, including the tool name, schema, and inline handler implementation.
      "cache-view",
      {
        title: "Cache View",
        description: "Inspect specific cache entries in Magento 2",
        inputSchema: {
          key: z.string()
            .describe("Cache key to inspect"),
          type: z.string()
            .optional()
            .describe("Cache type (optional)")
        }
      },
      async ({ key, type }) => {
        const typeArg = type ? `--type=${type}` : '';
        const command = `magerun2 cache:view ${typeArg} "${key}"`.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 entry for key "${key}":\n\n${result.data}`
          }]
        };
      }
    );

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