Skip to main content
Glama
dockergiant

RollDev MCP Server

by dockergiant

rolldev_list_environments

Lists all active RollDev environments and their directories, returning structured JSON for environment management and monitoring.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • server.js:86-98 (registration)
    Tool registration: 'rolldev_list_environments' is registered as a ListTools handler with no required input schema.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "rolldev_list_environments",
            description:
              "List all running RollDev environments with their directories (returns structured JSON)",
            inputSchema: {
              type: "object",
              properties: {},
              required: [],
            },
          },
  • Handler dispatch: the CallToolRequestSchema routes 'rolldev_list_environments' to this.listEnvironments()
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      switch (request.params.name) {
        case "rolldev_list_environments":
          return await this.listEnvironments();
  • Core handler: listEnvironments() executes 'roll status' command, parses output, and returns structured JSON with environment details (name, path, url, network, containers).
    async listEnvironments() {
      try {
        const result = await this.executeCommand(
          "roll",
          ["status"],
          process.cwd(),
        );
    
        if (result.code === 0) {
          const environments = this.parseEnvironmentList(result.stdout);
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    success: true,
                    command: "roll status",
                    exit_code: result.code,
                    environments: environments.map((env) => ({
                      name: env.name,
                      path: env.path,
                      url: env.url,
                      network: env.network,
                      containers: env.containers,
                    })),
                    raw_output: result.stdout,
                  },
                  null,
                  2,
                ),
              },
            ],
            isError: false,
          };
        } else {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    success: false,
                    command: "roll 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: "roll status",
                  exit_code: -1,
                  environments: [],
                  error: error.message,
                  raw_output: error.stdout || "",
                  raw_errors: error.stderr || "",
                },
                null,
                2,
              ),
            },
          ],
          isError: true,
        };
      }
    }
  • Helper: parseEnvironmentList() parses the raw 'roll status' output line-by-line, extracting project names, directories, URLs, networks, and container counts.
    parseEnvironmentList(output) {
      const environments = [];
      const lines = output.split("\n");
    
      let currentProject = null;
      let currentPath = null;
      let currentUrl = null;
      let currentNetwork = null;
      let currentContainers = 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") ||
          trimmed.includes("RollDev Services")
        ) {
          continue;
        }
    
        // Remove ANSI color codes for parsing
        const cleanLine = trimmed.replace(/\x1b\[[0-9;]*m/g, "");
    
        // Look for project name pattern: "ai-demo a magento2 project"
        const projectMatch = cleanLine.match(/^(\S+)\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) {
          currentPath = directoryMatch[1];
          continue;
        }
    
        // Look for project URL pattern: "Project URL: https://app.ai-demo.test"
        const urlMatch = cleanLine.match(/^\s*Project URL:\s*(.+)$/);
        if (urlMatch) {
          currentUrl = urlMatch[1];
          continue;
        }
    
        // Look for docker network pattern: "Docker Network: ai-demo_default"
        const networkMatch = cleanLine.match(/^\s*Docker Network:\s*(.+)$/);
        if (networkMatch) {
          currentNetwork = networkMatch[1];
          continue;
        }
    
        // Look for containers running pattern: "Containers Running: 9"
        const containersMatch = cleanLine.match(/^\s*Containers Running:\s*(\d+)$/);
        if (containersMatch && currentProject) {
          currentContainers = parseInt(containersMatch[1]);
    
          // Add the environment when we have complete information
          environments.push({
            name: currentProject,
            path: currentPath,
            url: currentUrl,
            network: currentNetwork,
            containers: currentContainers,
            raw: line,
          });
    
          // Reset for next project
          currentProject = null;
          currentPath = null;
          currentUrl = null;
          currentNetwork = null;
          currentContainers = null;
          continue;
        }
    
        // Stop parsing when we hit the services section
        if (cleanLine.includes("NAME") && cleanLine.includes("STATE")) {
          break;
        }
      }
    
      return environments;
    }
Behavior3/5

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

No annotations are provided, so the description must carry the behavioral disclosure burden. It indicates a read operation (list), which is non-destructive. However, it does not specify authentication needs, rate limits, or side effects, but the explicit mention of 'returns structured JSON' clarifies the safe read nature.

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, front-loaded sentence that efficiently states the purpose and output. No redundant or extra information is present.

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?

Though the tool is simple with no parameters, the description lacks details about the output structure (e.g., fields like environment name or status) that would be helpful since there is no output schema. However, the main action and return type are covered, so it is minimally adequate.

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?

The tool has zero parameters, and schema coverage is 100% by default. According to the rules, a baseline of 4 applies. The description adds value by stating that the output includes directories and is structured JSON, which goes beyond the empty 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 specifies the action ('list') and resource ('running RollDev environments'), and mentions the return format ('structured JSON') and fields ('directories'). This distinguishes it from sibling tools like rolldev_start_project or rolldev_db_query.

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: use when you need to list running environments. However, it does not explicitly state when not to use or mention alternatives among siblings, which is less critical for a simple list tool.

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