rdp_debugger
Firefox 原生 RDP 调试器:断点、单步、调用栈、作用域、暂停中求值。
Instructions
Firefox 原生 RDP 调试器:断点、单步、调用栈、作用域、暂停中求值。
camoufox 是 Firefox,Playwright 走 Juggler 没有 CDP;这个工具直接开 RDP
(-start-debugger-server)把调试能力补齐。启动的浏览器继承服务端配置
(指纹 / 代理 / headless / os / locale / browser_version),只额外加调试端口与 RDP pref。
安全:端口没有认证,开端口必须先打开 devtools.chrome.enabled,也就是连上端口
就能用当前系统用户身份在浏览器主进程执行任意代码;同机其他用户也能连
127.0.0.1。默认端口是随机的空闲端口,只监听 loopback。
action: launch 启动带调试端口的浏览器(随机端口;已有会话会先关掉;继承服务端配置) attach 连到已在运行的调试端口(需要 port 或 unix_socket) enable listTabs → getTarget → threadActor,attach 线程并 detach 旧 target sources 列出脚本(url_substr 过滤;含 sourceStartLine/sourceLength) source 取脚本全文(longString 分片按 UTF-16 码元推进;超长显式截断) breakable_lines 某个脚本的可断行号 breakable_positions 某脚本/某一行的可停位置(columns_0based / columns_1based) set_breakpoint 下断点(source_url 走 sourceUrl,source 走 sourceId;列号 1-based 自动吸附) remove_breakpoint 删行断点(按当初下发的 location 精确删除;remove_all 清空) wait_paused 等下一次命中(只接受 resume/step/interrupt 之后新到的 paused) frames 当前暂停的完整调用栈(出错时返回 {"error": ...}) scopes 某帧的递归作用域链与 bindings(需要 frame_actor) evaluate 求值:给了 frame_actor 就在该暂停帧内求值(能读局部变量) step 单步 over / into / out resume 继续运行 interrupt 不等断点直接暂停(on_next=true 暂停在下一个语句) reload 刷新并重建会话 + 重下此前全部断点(先 detach 旧 target) xhr_breakpoint 在请求发出前暂停(path / method;remove=true 移除) status 会话状态 close 结束会话并关闭本次启动的浏览器
Args:
action: 见上。
port: RDP 端口。0(默认)= launch 时随机选空闲端口;attach 必须给具体端口。
url: launch 时打开的页面。
executable: 自定义 Firefox/camoufox 路径;默认用 camoufox 激活版本(与 launch_browser 一致)。
wait_page: launch 后等页面开始加载的秒数上限;reload 时是新会话的最长等待。
url_substr: 选标签页 / 过滤脚本的 URL 子串。enable 时匹配不到会报错并列出可用标签页。
target_type: enable 的 watcher 兜底目标类型(frame/process/worker)。
line: 断点行号,1-based;坐标就是 breakable_lines/breakable_positions 报出来的那套。
column: 断点列号,1-based(Error.stack / DevTools 界面习惯),会吸附到最近可停列。
condition: 断点条件表达式,如 i === 3。
frame_actor: 栈帧 actor(scopes/evaluate/step/resume 用)。
expression: evaluate 的 JS 表达式。
direction: step 方向 over / into / out(写错会报错,不会 KeyError)。
timeout_ms: wait_paused / interrupt / evaluate 的超时毫秒。
path: xhr_breakpoint 的 URL 子串,空表示任意请求。
method: xhr_breakpoint 的 HTTP 方法,"ANY" 表示全部;"remove" 视为移除。
on_next: interrupt 是否暂停在下一个语句(发送字符串 "onNext")。
require_frame: wait_paused 是否要求带 frame(interrupt 空闲暂停时 frame 可能为 null)。
save_path: source 落盘路径。
max_chars: source/evaluate 最多取多少字符(UTF-16 码元计,超过会显式提示)。
max_items: sources / breakable_lines 返回条数上限。
source: source actor(set_breakpoint 用它走 sourceId,可断 eval / new Function)。
source_url: 精确 URL(set_breakpoint 用它走 sourceUrl,内联脚本/导航后都能挂上)。
remove_all: remove_breakpoint / xhr_breakpoint 里清空所有已记录断点。
remove: xhr_breakpoint 用它移除(比 method="remove" 更明确)。
unix_socket: macOS/Linux 用 0700 临时目录里的 Unix socket 代替 TCP 端口。
socket_path: attach 时连已有的 Unix socket 路径(取自 launch 返回的 unix_socket)。
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": {
"action": "<action>"
},
"name": "rdp_debugger"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | about:blank | |
| line | No | ||
| path | No | ||
| port | No | ||
| action | Yes | ||
| column | No | ||
| method | No | ANY | |
| remove | No | ||
| source | No | ||
| on_next | No | ||
| condition | No | ||
| direction | No | over | |
| max_chars | No | ||
| max_items | No | ||
| save_path | No | ||
| wait_page | No | ||
| executable | No | ||
| expression | No | ||
| remove_all | No | ||
| source_url | No | ||
| timeout_ms | No | ||
| url_substr | No | ||
| frame_actor | No | ||
| socket_path | No | ||
| target_type | No | frame | |
| unix_socket | No | ||
| require_frame | No |