Skip to main content
Glama
run-as-root

Warden Magento MCP Server

by run-as-root

warden_list_environments

Lists all active Warden-managed Magento 2 development environments with their directory paths in structured JSON format.

Instructions

List all running Warden environments with their directories (returns structured JSON)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function for 'warden_list_environments' tool. Executes 'warden status' command, parses the output using parseEnvironmentList, and returns structured JSON response with list of environments or error details.
    async listEnvironments() {
      try {
        const result = await this.executeCommand(
          "warden",
          ["status"],
          process.cwd(),
        );
    
        if (result.code === 0) {
          const environments = this.parseEnvironmentList(result.stdout);
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    success: true,
                    command: "warden status",
                    exit_code: result.code,
                    environments: environments.map((env) => ({
                      name: env.name,
                      path: env.path,
                    })),
                    raw_output: result.stdout,
                  },
                  null,
                  2,
                ),
              },
            ],
            isError: false,
          };
        } else {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    success: false,
                    command: "warden status",
                    exit_code: result.code,
                    environments: [],
                    error: result.stderr || "Unknown error",
                    raw_output: result.stdout,
                  },
                  null,
                  2,
                ),
              },
            ],
            isError: true,
          };
        }
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  success: false,
                  command: "warden status",
                  exit_code: -1,
                  environments: [],
                  error: error.message,
                  raw_output: error.stdout || "",
                  raw_errors: error.stderr || "",
                },
                null,
                2,
              ),
            },
          ],
          isError: true,
        };
      }
    }
  • server.js:34-43 (registration)
    Tool registration in ListToolsRequestSchema handler, including name, description, and empty input schema.
    {
      name: "warden_list_environments",
      description:
        "List all running Warden environments with their directories (returns structured JSON)",
      inputSchema: {
        type: "object",
        properties: {},
        required: [],
      },
    },
  • server.js:321-322 (registration)
    Dispatch case in CallToolRequestSchema switch statement that routes calls to the listEnvironments handler.
    case "warden_list_environments":
      return await this.listEnvironments();
  • Input schema definition for the tool (empty object, no parameters required).
    inputSchema: {
      type: "object",
      properties: {},
      required: [],
    },
  • Helper function to parse 'warden status' output and extract environment names and project directories.
    parseEnvironmentList(output) {
      const environments = [];
      const lines = output.split("\n");
    
      let currentProject = null;
      let currentPath = null;
    
      for (const line of lines) {
        const trimmed = line.trim();
    
        // Skip empty lines and headers
        if (
          !trimmed ||
          trimmed.includes("No running environments found") ||
          trimmed.includes("Found the following")
        ) {
          continue;
        }
    
        // Remove ANSI color codes for parsing
        const cleanLine = trimmed.replace(/\x1b\[[0-9;]*m/g, "");
    
        // Look for project name pattern: "    projectname a magento2 project"
        const projectMatch = cleanLine.match(/^\s*(\w+)\s+a\s+\w+\s+project$/);
        if (projectMatch) {
          currentProject = projectMatch[1];
          continue;
        }
    
        // Look for project directory pattern: "       Project Directory: /path/to/project"
        const directoryMatch = cleanLine.match(/^\s*Project Directory:\s*(.+)$/);
        if (directoryMatch && currentProject) {
          currentPath = directoryMatch[1];
    
          // Add the environment when we have both name and path
          environments.push({
            name: currentProject,
            path: currentPath,
            raw: line,
          });
    
          // Reset for next project
          currentProject = null;
          currentPath = null;
          continue;
        }
    
        // Skip URL lines
        if (cleanLine.includes("Project URL:")) {
          continue;
        }
      }
    
      return environments;
    }
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 discloses that the tool returns structured JSON, which is useful behavioral context, but does not cover other aspects like performance, error handling, or authentication needs, leaving gaps for a tool with no annotation support.

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 core purpose and includes essential details about the output format, with no wasted words or redundancy.

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 simplicity (0 parameters, no output schema, no annotations), the description is fairly complete for a list operation, covering what it does and the return format. However, it could be more robust by addressing potential limitations or dependencies.

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 description coverage, the baseline is high. The description adds value by clarifying the output format ('structured JSON'), which is not covered by the schema, compensating for the lack of an output schema.

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 verb ('List') and resource ('all running Warden environments') with specific scope ('with their directories'), and distinguishes from siblings like warden_start_project or warden_stop_svc by focusing on listing rather than controlling environments.

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 when needing to view running environments, but lacks explicit guidance on when to use this versus alternatives like warden_start_project or warden_stop_svc, and does not mention prerequisites or exclusions.

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/run-as-root/warden-mcp-server'

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