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:
Via Composer (recommended): composer require woocommerce/qit-cli --dev
Set QIT_CLI_PATH environment variable: export QIT_CLI_PATH=/path/to/qit
Ensure 'qit' is available in your system PATH
For more information, visit: https://github.com/woocommerce/qit-cli
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env_id | No | Environment ID to stop. If not provided, stops all environments. |
Implementation Reference
- src/tools/environment.ts:177-181 (handler)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); },
- src/tools/environment.ts:169-176 (schema)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." ), }),
- src/tools/environment.ts:166-182 (registration)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); }, },
- src/tools/index.ts:10-19 (registration)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 }; });