# dap

> DAP 断点调试 — TS 直连 Godot editor 自带 DAP server(默认 127.0.0.1:6006,P9 移植)。 会话流:initialize → launch(或 attach)→ set_breakpoint(s) → configuration_done → (断点命中后) stack_trace/step_over/continue。 断点簿记本地自存 + setBreakpoints 全量重发(512 sources × 256 lines 上限);DAP 响应经 sensitive-key 清洗(防调试输出泄漏 secret)。 前置:editor 开启调试服务器(Editor Settings → Network → Debug Adapter,端口 6006);launch 还需 Debug 菜单"Deploy with Remote Debug"。 ⚠️ 只覆盖 GDScript(C# 断点需 .NET debugger);与 debug 工具(editor 插件面板 hook)并存互补,稳定性优先用本工具。

| 属性 | 值 |
|------|-----|
| 所属层 | editor |
| 安全级别 | guarded |
| 需要 Godot | 是 |
| 需要编辑器 | 是 |
| 只读 | 否 |
| 长耗时 | 是 |

## Actions

- `status`
- `get_settings`
- `set_settings`
- `initialize`
- `launch`
- `attach`
- `configuration_done`
- `disconnect`
- `terminate`
- `threads`
- `set_breakpoint`
- `remove_breakpoint`
- `list_breakpoints`
- `pause`
- `continue`
- `step_over`
- `stack_trace`
- `output`

## Parameters

| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| `action` | enum (18 项) | ✓ | Action type: status | get_settings | set_settings | initialize | launch | attach | configuration_done | disconnect | terminate | threads | set_breakpoint | remove_breakpoint | list_breakpoints | pause | continue | step_over | stack_trace | output |
| `session_id` | string |  | DAP 会话 id(默认 settings.default_session_id,初始 "default") |
| `host` | string |  | DAP host(默认 127.0.0.1;非 loopback 需 settings.allow_remote_hosts) |
| `port` | integer |  | DAP 端口(默认 6006) |
| `project_path` | string |  | 断点 source_path 用 res:// 相对路径时的项目根(转绝对路径给 DAP) |
| `timeout_ms` | integer |  | DAP 请求超时毫秒(默认 1000,上限 30000;launch 等慢操作建议传大) |
| `settings` | object |  | set_settings: 运行时 DAP 设置(host/port/timeout_ms/default_session_id/default_launch_args/default_attach_args/allow_remote_hosts) |
| `include_raw` | boolean |  | 响应附带清洗后的原始 DAP request/response/messages(调试协议层用) |
| `adapter_args` | object |  | launch/attach: 透传给 adapter 的参数字典(与默认合并,后者优先级高) |
| `program` | string |  | launch: 可选 program 参数 |
| `cwd` | string |  | launch: 可选工作目录 |
| `restart` | boolean |  | launch/attach/disconnect: DAP restart 标志 |
| `terminate_debuggee` | boolean |  | disconnect: 是否同时终止被调试进程 |
| `source_path` | string |  | set/remove_breakpoint: 脚本路径(res://... 或绝对路径;res:// 需配 project_path) |
| `line` | integer |  | set/remove_breakpoint: 1-based 行号 |
| `thread_id` | integer |  | pause/continue/step_over/stack_trace: DAP thread id(默认 1) |
| `disconnect` | boolean |  | terminate: 成功后同时关闭本地 DAP 会话(清断点簿记) |
| `client_id` | string |  | initialize: DAP clientID 标识(默认 godot-mcp-enhanced) |
| `client_name` | string |  | initialize: DAP clientName 显示名(默认 godot-mcp-enhanced) |
| `adapter_id` | string |  | initialize: DAP adapterID(默认 godot) |

## 风险分布

读 6 / 写 12

---
<!-- AUTO-GENERATED by scripts/gen-tool-docs.mjs from capability-matrix.json v0.32.21. DO NOT edit manually; re-run npm run gen:tool-docs after tool changes. -->
