Skip to main content
Glama
elgentos

Magento 2 Development MCP Server

by elgentos

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}` }] }; } );

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