debugger-connect
Connects to an app's JavaScript debugger and starts collecting console logs, reusing existing connections for React Native and Chromium debug sessions.
Instructions
Connect to an app's JavaScript debugger and start collecting console logs. Reuses an existing connection. React Native apps connect through Metro. Chromium uses the page's existing CDP session. Use when starting a debug session or before calling other debugger-* tools. Keep the same device_id for later debugger calls. If shared Metro reports an ambiguous iOS simulator or Android target, retry with the intended device's logicalDeviceId from the error. Returns connection details and, after a crash, a note with the previous log path if available. On Chromium or legacy Metro (such as Vega), projectRoot is empty. Fails if the runtime is unreachable.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"device_id": "<device_id>"
},
"name": "debugger-connect"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. Range: 1 to 65535. | |
| device_id | Yes | Device id from list-devices: iOS simulator UDID, Android serial, Vega serial (amazon-...), or Chromium device id (chromium-cdp-<port>). Pass this SAME id as device_id to every subsequent debugger-* call to pin them to this device. The returned logicalDeviceId is informational (Metro's own per-connection handle, absent on Vega); you do not switch to it. Forwarding it still resolves here, but the list-devices id is the stable one. On a Metro shared by several devices, a simulator UDID or Android serial is matched by the device's name (a simulator's name; an Android model, release and API level); the app's device log must then confirm it runs there. When another booted simulator or attached device shares that name, or the log does not confirm it, the error asks for the logicalDeviceId instead. |