Skip to main content
Glama
dockergiant

RollDev MCP Server

by dockergiant

rolldev_magento_cli

Execute Magento CLI commands inside a PHP-FPM container for your project. Specify the project path, command, and optional arguments or log output to a file.

Instructions

Run roll magento command inside the php-fpm container

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesPath to the project directory
commandYesMagento CLI command (without 'bin/magento' prefix)
argsNoAdditional arguments for the command
save_output_to_fileNoSave full output to a log file for later investigation (useful for long output)

Implementation Reference

  • server.js:205-237 (registration)
    Tool 'rolldev_magento_cli' registered in the ListToolsRequestSchema handler with name, description, and inputSchema (schema including project_path, command, args, save_output_to_file).
    {
      name: "rolldev_magento_cli",
      description: "Run roll magento command inside the php-fpm container",
      inputSchema: {
        type: "object",
        properties: {
          project_path: {
            type: "string",
            description: "Path to the project directory",
          },
          command: {
            type: "string",
            description:
              "Magento CLI command (without 'bin/magento' prefix)",
          },
          args: {
            type: "array",
            description: "Additional arguments for the command",
            items: {
              type: "string",
            },
            default: [],
          },
          save_output_to_file: {
            type: "boolean",
            description:
              "Save full output to a log file for later investigation (useful for long output)",
            default: false,
          },
        },
        required: ["project_path", "command"],
      },
    },
  • The runMagentoCli method implements the tool handler. It builds a 'roll magento <command>' CLI call via executeRollCommand with a 5-minute timeout, executing inside the php-fpm container.
    async runMagentoCli(args) {
      const { project_path, command, args: commandArgs = [], save_output_to_file = false } = args;
    
      const rollCommand = [
        "magento",
        command,
        ...commandArgs,
      ];
    
      // 5 minute timeout for most Magento commands
      const timeoutMs = 300000;
    
      return await this.executeRollCommand(
        project_path,
        rollCommand,
        `Running Magento CLI: roll magento ${command}`,
        timeoutMs,
        save_output_to_file,
      );
    }
  • Input schema for rolldev_magento_cli: requires project_path (string) and command (string), accepts optional args (array of strings) and save_output_to_file (boolean, default false).
    inputSchema: {
      type: "object",
      properties: {
        project_path: {
          type: "string",
          description: "Path to the project directory",
        },
        command: {
          type: "string",
          description:
            "Magento CLI command (without 'bin/magento' prefix)",
        },
        args: {
          type: "array",
          description: "Additional arguments for the command",
          items: {
            type: "string",
          },
          default: [],
        },
        save_output_to_file: {
          type: "boolean",
          description:
            "Save full output to a log file for later investigation (useful for long output)",
          default: false,
        },
      },
      required: ["project_path", "command"],
    },
  • executeRollCommand is a shared helper used by runMagentoCli and other tools. It runs 'roll <args>' via spawn, handles file-saving of output, and formats the response.
      async executeRollCommand(project_path, rollArgs, description, timeoutMs = 300000, saveToFile = false) {
        if (!project_path) {
          throw new Error("project_path is required");
        }
    
        const normalizedProjectPath = project_path.replace(/\/+$/, "");
        const absoluteProjectPath = resolve(normalizedProjectPath);
    
        if (!existsSync(absoluteProjectPath)) {
          throw new Error(
            `Project directory does not exist: ${absoluteProjectPath}`,
          );
        }
    
        try {
          const result = await this.executeCommand(
            "roll",
            rollArgs,
            absoluteProjectPath,
            timeoutMs,
          );
    
          const commandStr = `roll ${rollArgs.join(" ")}`;
          const isSuccess = result.code === 0;
    
          // Save output to file only when explicitly requested
          const logFilePath = saveToFile
            ? this.saveOutputToFile(result.stdout, result.stderr, commandStr, absoluteProjectPath)
            : null;
    
          let responseText;
          if (logFilePath) {
            // Output saved to file
            const outputPreview = (result.stdout || "").substring(0, 500);
            const stderrPreview = (result.stderr || "").substring(0, 500);
            responseText = `${description} ${isSuccess ? "completed successfully" : "failed"}!
    
    Command: ${commandStr}
    Working directory: ${absoluteProjectPath}
    Exit Code: ${result.code}${result.timedOut ? " (TIMED OUT)" : ""}
    
    📁 Full output saved to file:
    ${logFilePath}
    
    Output Preview (first 500 chars):
    ${outputPreview || "(no output)"}${(result.stdout || "").length > 500 ? "\n...(truncated)" : ""}
    
    Errors Preview (first 500 chars):
    ${stderrPreview || "(no errors)"}${(result.stderr || "").length > 500 ? "\n...(truncated)" : ""}`;
          } else {
            // Return inline output
            responseText = `${description} ${isSuccess ? "completed successfully" : "failed"}!
    
    Command: ${commandStr}
    Working directory: ${absoluteProjectPath}
    Exit Code: ${result.code}${result.timedOut ? " (TIMED OUT)" : ""}
    
    Output:
    ${result.stdout || "(no output)"}
    
    Errors:
    ${result.stderr || "(no errors)"}`;
          }
    
          return {
            content: [
              {
                type: "text",
                text: responseText,
              },
            ],
            isError: !isSuccess,
          };
        } catch (error) {
          const commandStr = `roll ${rollArgs.join(" ")}`;
    
          // Save error output to file only when explicitly requested
          const logFilePath = saveToFile
            ? this.saveOutputToFile(error.stdout, error.stderr, commandStr, absoluteProjectPath)
            : null;
    
          let responseText;
          if (logFilePath) {
            responseText = `Failed to execute command:
    
    Command: ${commandStr}
    Working directory: ${absoluteProjectPath}
    Error: ${error.message}
    
    📁 Full output saved to file:
    ${logFilePath}`;
          } else {
            responseText = `Failed to execute command:
    
    Command: ${commandStr}
    Working directory: ${absoluteProjectPath}
    Error: ${error.message}
    
    Output:
    ${error.stdout || "(no output)"}
    
    Errors:
    ${error.stderr || "(no errors)"}`;
          }
    
          return {
            content: [
              {
                type: "text",
                text: responseText,
              },
            ],
            isError: true,
          };
        }
      }
  • Case statement in CallToolRequestSchema dispatching to runMagentoCli when tool name is 'rolldev_magento_cli'.
    case "rolldev_magento_cli":
      return await this.runMagentoCli(request.params.arguments);
Behavior2/5

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

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It only states that the command is run inside a container, with no mention of return values, error handling, persistence, or side effects. This is insufficient for a tool that executes arbitrary commands.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short sentence, making it concise and front-loaded. However, the word 'roll' seems out of place (likely a typo), slightly detracting from clarity.

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

Completeness3/5

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

The tool is relatively simple with 4 parameters and no output schema. The description does not explain return values or output behavior, but given the schema coverage and tool purpose, it is minimally adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so the schema already documents all parameters. The description adds no additional meaning beyond what is in the schema, achieving the baseline of 3.

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

Purpose4/5

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

Description clearly indicates the tool runs a Magento CLI command inside a php-fpm container. The verb 'run' and resource 'magento command' are specific, and it distinguishes from sibling tools like rolldev_composer or rolldev_db_query. However, the phrasing 'roll magento command' is slightly ambiguous (possibly a typo), preventing a perfect score.

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

Usage Guidelines3/5

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

The description implies usage for running Magento CLI commands in a container, but provides no explicit guidance on when to use this tool versus alternatives like rolldev_magento2_init or rolldev_php_script. No when-not or alternative suggestions are given.

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/dockergiant/rolldev-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server