Skip to main content
Glama

stop_environment

Stop a running QIT test environment to free resources. Specify an environment ID to stop a single instance, or omit to stop all active environments.

Instructions

Stop a running QIT test environment.

⚠️ QIT CLI not detected. QIT CLI not found. Please install it using one of these methods:

  1. Via Composer (recommended): composer require woocommerce/qit-cli --dev

  2. Set QIT_CLI_PATH environment variable: export QIT_CLI_PATH=/path/to/qit

  3. Ensure 'qit' is available in your system PATH

For more information, visit: https://github.com/woocommerce/qit-cli

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
env_idNoEnvironment ID to stop. If not provided, stops all environments.

Implementation Reference

  • The main handler function for the 'stop_environment' tool. It constructs the command arguments for the QIT CLI 'env:down' command, optionally using a specific environment ID, and executes it via executeAndFormat.
    handler: async (args: { env_id?: string }) => {
      const positional = args.env_id ? [args.env_id] : [];
      const cmdArgs = buildArgs("env:down", positional, {});
      return executeAndFormat(cmdArgs);
    },
  • Zod input schema validating the optional 'env_id' parameter for the tool.
    inputSchema: z.object({
      env_id: z
        .string()
        .optional()
        .describe(
          "Environment ID to stop. If not provided, stops all environments."
        ),
    }),
  • Complete tool object definition within the 'environmentTools' export, registering the tool's name, description, schema, and handler.
    stop_environment: {
      name: "stop_environment",
      description: "Stop a running QIT test environment.",
      inputSchema: z.object({
        env_id: z
          .string()
          .optional()
          .describe(
            "Environment ID to stop. If not provided, stops all environments."
          ),
      }),
      handler: async (args: { env_id?: string }) => {
        const positional = args.env_id ? [args.env_id] : [];
        const cmdArgs = buildArgs("env:down", positional, {});
        return executeAndFormat(cmdArgs);
      },
    },
  • Aggregates 'environmentTools' (including 'stop_environment') into the central 'allTools' export used by the MCP server.
    export const allTools = {
      ...authTools,
      ...testExecutionTools,
      ...testResultsTools,
      ...groupsTools,
      ...environmentTools,
      ...packagesTools,
      ...configTools,
      ...utilitiesTools,
    };
  • src/server.ts:29-38 (registration)
    Registers all tools from 'allTools' (including 'stop_environment') with the MCP server for the ListTools request.
      const tools = Object.entries(allTools).map(([_, tool]) => ({
        name: tool.name,
        description: cliInfo
          ? tool.description
          : `${tool.description}\n\n⚠️ QIT CLI not detected. ${getQitCliNotFoundError()}`,
        inputSchema: zodToJsonSchema(tool.inputSchema),
      }));
    
      return { 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/woocommerce/qit-mcp'

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