Skip to main content
Glama
elgentos

Magento 2 Development MCP Server

by elgentos

Setup DB Status

setup-db-status

Check if Magento 2 database requires setup:upgrade by verifying current database status and identifying pending schema or data updates.

Instructions

Check Magento 2 database status to see if setup:upgrade is needed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:1061-1089 (registration)
    Registration of the 'setup-db-status' MCP tool, including title, description, empty input schema, and inline handler function that runs 'magerun2 setup:db:status' command via the executeMagerun2Command helper.
    server.registerTool(
      "setup-db-status",
      {
        title: "Setup DB Status",
        description: "Check Magento 2 database status to see if setup:upgrade is needed",
        inputSchema: {}
      },
      async () => {
        const command = `magerun2 setup:db:status`;
        const result = await executeMagerun2Command(command);
    
        if (!result.success) {
          return {
            content: [{
              type: "text",
              text: result.error
            }],
            isError: true
          };
        }
    
        return {
          content: [{
            type: "text",
            text: `Database status:\n\n${result.data}`
          }]
        };
      }
    );
  • The core handler function for 'setup-db-status' tool. Executes the magerun2 command, handles errors, and returns formatted text content with database status.
    async () => {
      const command = `magerun2 setup:db:status`;
      const result = await executeMagerun2Command(command);
    
      if (!result.success) {
        return {
          content: [{
            type: "text",
            text: result.error
          }],
          isError: true
        };
      }
    
      return {
        content: [{
          type: "text",
          text: `Database status:\n\n${result.data}`
        }]
      };
    }
  • Shared helper function used by 'setup-db-status' (and other tools) to execute magerun2 CLI commands with timeout, JSON parsing support, and Magento-specific error handling.
    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
        };
      }
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It describes the tool's purpose as a status check, implying it's a read-only operation, but doesn't disclose details like output format, error conditions, or any side effects. This is adequate but lacks rich behavioral context.

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 front-loads the key information ('Check Magento 2 database status') and avoids any wasted words, making it highly concise and well-structured.

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

Completeness4/5

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

Given the tool's low complexity (0 parameters, no output schema), the description is complete enough for its purpose. It clearly states what the tool does and when to use it, though it could benefit from more behavioral details like output expectations, but this is minor for a simple status check.

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?

With 0 parameters and 100% schema coverage, the baseline is 4. The description adds no parameter details, which is appropriate since there are none, and it doesn't need to compensate for any gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Check Magento 2 database status') and the purpose ('to see if setup:upgrade is needed'), using precise verbs and distinguishing it from sibling tools like 'setup-upgrade' (which performs the upgrade) and 'db-query' (which runs queries).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

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

It explicitly states when to use this tool ('to see if setup:upgrade is needed'), providing clear context for its application in checking database status before potentially running the upgrade, and distinguishes it from alternatives like 'setup-upgrade' itself.

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