Skip to main content
Glama
qckfx

Node.js Debugger MCP Server

by qckfx

kill_process

Terminate a running Node.js process by specifying its Process ID to manage debugging sessions and free system resources.

Instructions

Kill a managed Node.js process

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidYesProcess ID to kill

Implementation Reference

  • The handler function that executes the kill_process tool logic. It retrieves the managed process by PID, sends a SIGTERM signal to kill it, removes it from the managed processes map, and returns appropriate success or error messages.
    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,
        };
      }
  • The tool schema definition in ListToolsRequestHandler, defining the input schema with a required 'pid' number parameter and description.
    {
      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:247-248 (registration)
    The dispatch/registration in the CallToolRequestHandler switch statement that routes 'kill_process' calls to the killProcess handler method.
    case "kill_process":
      return await this.killProcess(args as { pid: number });

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/qckfx/node-debugger-mcp'

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