Have Claude step through a failing test instead of reading prints
When to use: A test fails with no clear stack — print debugging will take forever.
Prerequisites
- DebugMCP installed in VS Code — Marketplace → ozzafar.debugmcpextension
- Language debug extension (e.g., Python for .py) — Auto-prompted by VS Code on first run
Flow
-
Set upUse debugmcp. Add a breakpoint on the line
assert result == expectedin tests/test_orders.py.✓ Copied→ Breakpoint reported as set; line content matched -
RunStart debugging tests/test_orders.py with the failing test.✓ Copied→ Session paused at breakpoint
-
InspectShow me all local variables. What's
resultactually contain?✓ Copied→ Variable dump with concrete values -
Step + diagnoseStep into the function that built
result. Tell me where it diverged from expected.✓ Copied→ Code-anchored root cause
Outcome: Bug located by stepping, not guessing — minutes instead of an hour.
Pitfalls
- Breakpoint by line number drifts after edits — Use line content matching (DebugMCP supports this natively)