stop_tomcat
Terminate the Tomcat process in Gradle-based applications to stop the server. Use the force option for immediate termination with SIGKILL.
Instructions
Terminate Tomcat process
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Force termination with SIGKILL |
Implementation Reference
- src/tools/index.js:20-33 (registration)Registers the 'stop_tomcat' tool in the TOOLS array, including its name, description, and input schema defining an optional 'force' boolean parameter.{ name: "stop_tomcat", description: "Terminate Tomcat process", inputSchema: { type: "object", properties: { force: { type: "boolean", description: "Force termination with SIGKILL", default: false } } } },
- src/tools/index.js:114-115 (handler)Handler dispatch in handleToolCall function that invokes ProcessManager.stopTomcat with the force argument for the stop_tomcat tool.case "stop_tomcat": return await processManager.stopTomcat(args.force);
- src/process-manager.js:69-95 (handler)Core implementation of the stop_tomcat tool logic in ProcessManager class: stops the Tomcat process with SIGTERM (graceful) or SIGKILL (force), with a 10-second timeout fallback to force kill.async stopTomcat(force = false) { if (!this.process) { return { success: true, message: 'Tomcat is not running' }; } return new Promise((resolve) => { const pid = this.process.pid; if (force) { this.process.kill('SIGKILL'); } else { this.process.kill('SIGTERM'); } const timeout = setTimeout(() => { if (this.process) { this.process.kill('SIGKILL'); } resolve({ success: true, message: `Tomcat process ${pid} forcefully terminated` }); }, 10000); this.process.on('exit', () => { clearTimeout(timeout); resolve({ success: true, message: `Tomcat process ${pid} terminated gracefully` }); }); }); }