retry_connect
Manually reconnects to the Node.js debugger when the connection is lost or unstable, allowing debugging to resume without restarting the server.
Instructions
Manually triggers a reconnection attempt to the Node.js debugger
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | Optional port to connect to. Defaults to current port (9229) |
Implementation Reference
- src/mcp-server.js:1133-1165 (handler)The handler function for the 'retry_connect' tool. It optionally updates the port, disconnects the current WebSocket if connected, resets the retry count, and initializes a new connection attempt to the Node.js debugger.async ({ port }) => { try { // If a new port is specified, update the inspector's port if (port && port !== inspector.port) { inspector.port = port; } // If already connected, disconnect first if (inspector.connected && inspector.ws) { inspector.ws.close(); inspector.connected = false; inspector.debuggerEnabled = false; } // Reset retry count and initialize inspector.retryCount = 0; inspector.initialize(); return { content: [{ type: "text", text: `Attempting to connect to Node.js debugger on port ${inspector.port}...` }] }; } catch (err) { return { content: [{ type: "text", text: `Error initiating connection retry: ${err.message}` }] }; } }
- src/mcp-server.js:1130-1132 (schema)The input schema definition for the 'retry_connect' tool, specifying an optional 'port' parameter using Zod validation.{ port: z.number().optional().describe("Optional port to connect to. Defaults to current port (9229)") },
- src/mcp-server.js:1127-1166 (registration)The registration of the 'retry_connect' tool using server.tool(), including the tool name, description, input schema, and inline handler function.server.tool( "retry_connect", "Manually triggers a reconnection attempt to the Node.js debugger", { port: z.number().optional().describe("Optional port to connect to. Defaults to current port (9229)") }, async ({ port }) => { try { // If a new port is specified, update the inspector's port if (port && port !== inspector.port) { inspector.port = port; } // If already connected, disconnect first if (inspector.connected && inspector.ws) { inspector.ws.close(); inspector.connected = false; inspector.debuggerEnabled = false; } // Reset retry count and initialize inspector.retryCount = 0; inspector.initialize(); return { content: [{ type: "text", text: `Attempting to connect to Node.js debugger on port ${inspector.port}...` }] }; } catch (err) { return { content: [{ type: "text", text: `Error initiating connection retry: ${err.message}` }] }; } } );