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
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Cache key to inspect | |
| type | No | Cache type (optional) |
Implementation Reference
- src/index.ts:354-375 (handler)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}` }] }; } );
- src/index.ts:343-353 (schema)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}` }] }; } );