AI Agent Skill: VS Code DAP Debugger Control via CLI
Objective
You (the AI Agent) can directly control the VS Code Debugger (DAP) via terminal CLI commands.
No stdio connection needed — use one-off CLI commands to control the full debug lifecycle.
CLI Interface
All commands use: npx @uhd_kr/mcp-debug-tools <command> [args]
Local Path Fallback (When npx is unavailable)
If npx is unavailable (e.g., offline, network restrictions), you can run the CLI directly from the VS Code extension's install directory.
macOS / Linux:
node ~/.vscode/extensions/uhd.mcp-debug-tools-*/out/cli.js <command> [args]
Windows (PowerShell):
node "$env:USERPROFILE\.vscode\extensions\uhd.mcp-debug-tools-*\out\cli.js" <command> [args]
Windows (CMD):
node "%USERPROFILE%\.vscode\extensions\uhd.mcp-debug-tools-*\out\cli.js" <command> [args]
Tip: If you installed mcp-debug-tools globally via npm install -g @uhd_kr/mcp-debug-tools, you can simply run mcp-debug-tools <command> directly without npx.
Key Rules:
stdout = pure JSON result. Always parse stdout only.
stderr = connection logs. Ignore stderr.
- On error, read the JSON error message, correct arguments, and retry.
Commands
| Command |
Usage |
| list |
npx mcp-debug-tools list — Discover all available tools and their input schemas |
| call |
npx mcp-debug-tools call <toolName> [jsonArgs] — Execute a specific tool |
| read |
npx mcp-debug-tools read <resourceUri> — Read a debugger state resource |
Available Tools — Quick Reference
Session & Config Management
| Tool |
Params |
Description |
get-active-session |
— |
Check if debugger is running, get session info |
get-debug-state |
— |
Get full debug state: session + all breakpoints |
list-debug-configs |
— |
List all configurations from launch.json |
select-debug-config |
configName |
Select a specific debug configuration by name |
start-debug |
config (name from launch.json) |
Start a debug session |
stop-debug |
— |
Stop the active debug session |
get-workspace-info |
— |
Get current workspace information |
list-vscode-instances |
— |
List all active VS Code instances |
select-vscode-instance |
port?, workspace? |
Connect to a specific VS Code instance |
Breakpoint Management
| Tool |
Params |
Description |
add-breakpoint |
file, line, condition?, hitCondition?, logMessage? |
Add a single breakpoint |
add-breakpoints |
breakpoints[] (array of above) |
Add multiple breakpoints at once |
remove-breakpoint |
file, line |
Remove a breakpoint at specific location |
clear-breakpoints |
files?[] |
Remove all breakpoints (or from specific files) |
list-breakpoints |
— |
List all breakpoints (basic) |
get-breakpoints |
— |
Get detailed breakpoint info including conditions |
Execution Control
| Tool |
Params |
Description |
continue |
— |
Resume execution |
step-over |
— |
Step over current line |
step-into |
— |
Step into function call |
step-out |
— |
Step out of current function |
pause |
— |
Pause running execution |
State Inspection
| Tool |
Params |
Description |
get-call-stack |
threadId?, startFrame?, levels? |
Get call stack frames |
get-active-stack-item |
— |
Get the currently active stack frame |
get-variables-scope |
frameId?, scopeName? |
Get all variables in scope |
inspect-variable |
variableName |
Get detailed info about a specific variable |
evaluate-expression |
expression |
Evaluate an expression in debug context |
get-thread-list |
— |
List all threads |
get-exception-info |
limit?, includeStackTrace? |
Get recent exception details |
get-debug-console |
limit?, filter? |
Retrieve debug console output |
get-dap-log |
— |
Get raw DAP protocol messages |
CLI Examples
# Check debugger status
npx mcp-debug-tools call get-active-session
# Set a conditional breakpoint
npx mcp-debug-tools call add-breakpoint '{"file": "src/app.ts", "line": 15, "condition": "x > 10"}'
# Set multiple breakpoints at once
npx mcp-debug-tools call add-breakpoints '{"breakpoints": [{"file": "src/app.ts", "line": 10}, {"file": "src/app.ts", "line": 20}]}'
# Start debugging with a named config
npx mcp-debug-tools call start-debug '{"config": "Launch Program"}'
# Step and inspect
npx mcp-debug-tools call step-over
npx mcp-debug-tools call get-variables-scope
npx mcp-debug-tools call inspect-variable '{"variableName": "result"}'
# Evaluate an expression at current breakpoint
npx mcp-debug-tools call evaluate-expression '{"expression": "arr.length"}'
# Read resources directly
npx mcp-debug-tools read "dap://log"
Standard Debugging Workflow
- Check Status →
get-active-session
- List Configs →
list-debug-configs (find the right launch config)
- Set Breakpoints →
add-breakpoint or add-breakpoints
- Start Debug →
start-debug with the config name
- Analyze State →
get-call-stack + get-variables-scope
- Inspect Details →
inspect-variable or evaluate-expression
- Step Through →
step-over / step-into / step-out, repeat 5-6
- Fix Code → Edit source, then restart debugger to verify
1---2name: dap-cli-debugging3description: Control the VS Code Debugger (DAP) via CLI commands using mcp-debug-tools. Use when debugging, setting breakpoints, stepping through code, or inspecting variables.4---56# AI Agent Skill: VS Code DAP Debugger Control via CLI78## Objective9You (the AI Agent) can directly control the VS Code **Debugger (DAP)** via terminal CLI commands.10No stdio connection needed — use one-off CLI commands to control the full debug lifecycle.1112## CLI Interface1314All commands use: `npx @uhd_kr/mcp-debug-tools <command> [args]`1516### Local Path Fallback (When npx is unavailable)1718If `npx` is unavailable (e.g., offline, network restrictions), you can run the CLI directly from the VS Code extension's install directory.1920**macOS / Linux:**21```bash22node ~/.vscode/extensions/uhd.mcp-debug-tools-*/out/cli.js <command> [args]23```2425**Windows (PowerShell):**26```powershell27node "$env:USERPROFILE\.vscode\extensions\uhd.mcp-debug-tools-*\out\cli.js" <command> [args]28```2930**Windows (CMD):**31```cmd32node "%USERPROFILE%\.vscode\extensions\uhd.mcp-debug-tools-*\out\cli.js" <command> [args]33```3435> **Tip**: If you installed mcp-debug-tools globally via `npm install -g @uhd_kr/mcp-debug-tools`, you can simply run `mcp-debug-tools <command>` directly without `npx`.3637**Key Rules:**38- `stdout` = pure JSON result. **Always parse stdout only.**39- `stderr` = connection logs. **Ignore stderr.**40- On error, read the JSON error message, correct arguments, and retry.4142### Commands4344| Command | Usage |45|---------|-------|46| **list** | `npx mcp-debug-tools list` — Discover all available tools and their input schemas |47| **call** | `npx mcp-debug-tools call <toolName> [jsonArgs]` — Execute a specific tool |48| **read** | `npx mcp-debug-tools read <resourceUri>` — Read a debugger state resource |4950## Available Tools — Quick Reference5152### Session & Config Management53| Tool | Params | Description |54|------|--------|-------------|55| `get-active-session` | — | Check if debugger is running, get session info |56| `get-debug-state` | — | Get full debug state: session + all breakpoints |57| `list-debug-configs` | — | List all configurations from launch.json |58| `select-debug-config` | `configName` | Select a specific debug configuration by name |59| `start-debug` | `config` (name from launch.json) | Start a debug session |60| `stop-debug` | — | Stop the active debug session |61| `get-workspace-info` | — | Get current workspace information |62| `list-vscode-instances` | — | List all active VS Code instances |63| `select-vscode-instance` | `port?`, `workspace?` | Connect to a specific VS Code instance |6465### Breakpoint Management66| Tool | Params | Description |67|------|--------|-------------|68| `add-breakpoint` | `file`, `line`, `condition?`, `hitCondition?`, `logMessage?` | Add a single breakpoint |69| `add-breakpoints` | `breakpoints[]` (array of above) | Add multiple breakpoints at once |70| `remove-breakpoint` | `file`, `line` | Remove a breakpoint at specific location |71| `clear-breakpoints` | `files?[]` | Remove all breakpoints (or from specific files) |72| `list-breakpoints` | — | List all breakpoints (basic) |73| `get-breakpoints` | — | Get detailed breakpoint info including conditions |7475### Execution Control76| Tool | Params | Description |77|------|--------|-------------|78| `continue` | — | Resume execution |79| `step-over` | — | Step over current line |80| `step-into` | — | Step into function call |81| `step-out` | — | Step out of current function |82| `pause` | — | Pause running execution |8384### State Inspection85| Tool | Params | Description |86|------|--------|-------------|87| `get-call-stack` | `threadId?`, `startFrame?`, `levels?` | Get call stack frames |88| `get-active-stack-item` | — | Get the currently active stack frame |89| `get-variables-scope` | `frameId?`, `scopeName?` | Get all variables in scope |90| `inspect-variable` | `variableName` | Get detailed info about a specific variable |91| `evaluate-expression` | `expression` | Evaluate an expression in debug context |92| `get-thread-list` | — | List all threads |93| `get-exception-info` | `limit?`, `includeStackTrace?` | Get recent exception details |94| `get-debug-console` | `limit?`, `filter?` | Retrieve debug console output |95| `get-dap-log` | — | Get raw DAP protocol messages |9697## CLI Examples9899```bash100# Check debugger status101npx mcp-debug-tools call get-active-session102103# Set a conditional breakpoint104npx mcp-debug-tools call add-breakpoint '{"file": "src/app.ts", "line": 15, "condition": "x > 10"}'105106# Set multiple breakpoints at once107npx mcp-debug-tools call add-breakpoints '{"breakpoints": [{"file": "src/app.ts", "line": 10}, {"file": "src/app.ts", "line": 20}]}'108109# Start debugging with a named config110npx mcp-debug-tools call start-debug '{"config": "Launch Program"}'111112# Step and inspect113npx mcp-debug-tools call step-over114npx mcp-debug-tools call get-variables-scope115npx mcp-debug-tools call inspect-variable '{"variableName": "result"}'116117# Evaluate an expression at current breakpoint118npx mcp-debug-tools call evaluate-expression '{"expression": "arr.length"}'119120# Read resources directly121npx mcp-debug-tools read "dap://log"122```123124## Standard Debugging Workflow1251261. **Check Status** → `get-active-session`1272. **List Configs** → `list-debug-configs` (find the right launch config)1283. **Set Breakpoints** → `add-breakpoint` or `add-breakpoints`1294. **Start Debug** → `start-debug` with the config name1305. **Analyze State** → `get-call-stack` + `get-variables-scope`1316. **Inspect Details** → `inspect-variable` or `evaluate-expression`1327. **Step Through** → `step-over` / `step-into` / `step-out`, repeat 5-61338. **Fix Code** → Edit source, then restart debugger to verify