warden_stop_svc
Stop Warden system services for a Magento 2 project to manage development environment resources. Specify the project directory path to halt services.
Instructions
Stop Warden system services
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | Path to the project directory |
Implementation Reference
- server.js:538-545 (handler)The handler function for warden_stop_svc tool. It extracts the project_path argument and calls executeWardenCommand with warden svc down to stop the services.async stopSvc(args) { const { project_path } = args; return await this.executeWardenCommand( project_path, ["svc", "down"], "Stopping Warden system services", ); }
- server.js:86-99 (schema)The tool schema definition including name, description, and inputSchema requiring project_path.{ name: "warden_stop_svc", description: "Stop Warden system services", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to the project directory", }, }, required: ["project_path"], }, },
- server.js:329-330 (registration)The registration in the CallToolRequestHandler switch statement that maps the tool name to the stopSvc handler method.case "warden_stop_svc": return await this.stopSvc(request.params.arguments);
- server.js:831-876 (helper)Helper method used by stopSvc to execute the warden command, handle paths, validate existence, run the command, and format the response.async executeWardenCommand(project_path, wardenArgs, description) { 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( "warden", wardenArgs, absoluteProjectPath, ); const commandStr = `warden ${wardenArgs.join(" ")}`; const isSuccess = result.code === 0; return { content: [ { type: "text", text: `${description} ${isSuccess ? "completed successfully" : "failed"}!\n\nCommand: ${commandStr}\nWorking directory: ${absoluteProjectPath}\nExit Code: ${result.code}\n\nOutput:\n${result.stdout || "(no output)"}\n\nErrors:\n${result.stderr || "(no errors)"}`, }, ], isError: !isSuccess, }; } catch (error) { const commandStr = `warden ${wardenArgs.join(" ")}`; return { content: [ { type: "text", text: `Failed to execute command:\n\nCommand: ${commandStr}\nWorking directory: ${absoluteProjectPath}\nError: ${error.message}\n\nOutput:\n${error.stdout || "(no output)"}\n\nErrors:\n${error.stderr || "(no errors)"}`, }, ], isError: true, }; } }