kill_process
Terminate a specified Node.js process by its ID using the debugging and process management capabilities of the Node.js Debugger MCP Server.
Instructions
Kill a managed Node.js process
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pid | Yes | Process ID to kill |
Implementation Reference
- src/index.ts:353-391 (handler)The main handler function for the 'kill_process' tool. It retrieves the managed process by PID, sends SIGTERM signal to kill it, removes from managed processes, and returns appropriate success or error response.private async killProcess(args: { pid: number }) { const managedProcess = this.managedProcesses.get(args.pid); if (!managedProcess) { return { content: [ { type: "text", text: `Process ${args.pid} not found in managed processes`, }, ], isError: true, }; } try { managedProcess.process.kill("SIGTERM"); this.managedProcesses.delete(args.pid); return { content: [ { type: "text", text: `Killed process ${args.pid}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error killing process: ${error}`, }, ], isError: true, }; } }
- src/index.ts:157-167 (registration)Registration of the 'kill_process' tool in the ListToolsRequestSchema response, including name, description, and input schema.{ name: "kill_process", description: "Kill a managed Node.js process", inputSchema: { type: "object", properties: { pid: { type: "number", description: "Process ID to kill" } }, required: ["pid"], }, },
- src/index.ts:160-166 (schema)Input schema for the 'kill_process' tool, defining the required 'pid' parameter as a number.inputSchema: { type: "object", properties: { pid: { type: "number", description: "Process ID to kill" } }, required: ["pid"], },
- src/index.ts:247-248 (registration)Dispatch case in CallToolRequestSchema handler that invokes the killProcess method for 'kill_process' tool calls.case "kill_process": return await this.killProcess(args as { pid: number });