Skip to main content
Glama
elgentos

Magento 2 Development MCP Server

by elgentos

sys-store-list

Retrieve a complete list of Magento 2 stores, websites, and store views in table, JSON, or CSV format for development and system management purposes.

Instructions

List all Magento 2 stores, websites, and store views

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoOutput formattable

Implementation Reference

  • The handler function for the 'sys-store-list' tool. It runs the 'magerun2 sys:store:list' command with the specified format (table, json, csv), handles errors, and returns formatted output.
    async ({ format = "table" }) => {
      const command = `magerun2 sys:store:list --format=${format}`;
      const result = await executeMagerun2Command(command, format === "json");
    
      if (!result.success) {
        return {
          content: [{
            type: "text",
            text: result.error
          }],
          isError: true
        };
      }
    
      const responseText = format === "json"
        ? `Store list (${format} format):\n\n${JSON.stringify(result.data, null, 2)}`
        : `Store list (${format} format):\n\n${result.data}`;
    
      return {
        content: [{
          type: "text",
          text: responseText
        }]
      };
    }
  • Input schema for the tool defining the 'format' parameter as an enum with values 'table', 'json', 'csv', defaulting to 'table'.
    inputSchema: {
      format: z.enum(["table", "json", "csv"])
        .default("table")
        .describe("Output format")
    }
  • src/index.ts:1161-1197 (registration)
    Registration of the 'sys-store-list' tool via server.registerTool, including title, description, input schema, and the handler function.
    server.registerTool(
      "sys-store-list",
      {
        title: "Store List",
        description: "List all Magento 2 stores, websites, and store views",
        inputSchema: {
          format: z.enum(["table", "json", "csv"])
            .default("table")
            .describe("Output format")
        }
      },
      async ({ format = "table" }) => {
        const command = `magerun2 sys:store:list --format=${format}`;
        const result = await executeMagerun2Command(command, format === "json");
    
        if (!result.success) {
          return {
            content: [{
              type: "text",
              text: result.error
            }],
            isError: true
          };
        }
    
        const responseText = format === "json"
          ? `Store list (${format} format):\n\n${JSON.stringify(result.data, null, 2)}`
          : `Store list (${format} format):\n\n${result.data}`;
    
        return {
          content: [{
            type: "text",
            text: responseText
          }]
        };
      }
    );

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