Skip to content

feat: breakpoint management tools — list/remove/clear + DAP breakpoint-event wiring (fixes #236) - #267

Merged
debugmcpdev merged 2 commits into
mainfrom
feat/breakpoint-management-236
Aug 5, 2026
Merged

feat: breakpoint management tools — list/remove/clear + DAP breakpoint-event wiring (fixes #236)#267
debugmcpdev merged 2 commits into
mainfrom
feat/breakpoint-management-236

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Closes #236.

Agents no longer have write-only breakpoints: this adds list_breakpoints, remove_breakpoint, and clear_breakpoints, wires the previously-dropped DAP breakpoint events end-to-end, and fixes a pre-existing gap where launch-time breakpoints never learned their verified state.

New tools

  • list_breakpoints {sessionId, file?} — flat array sorted by file/line with verified, condition, suspendPolicy, message, and the adapter-assigned numeric adapterId; plus count.
  • remove_breakpoint {sessionId, breakpointId | file+line} — id form removes one; file+line removes every breakpoint at that location (duplicates at a line are legal and DAP replace-all cannot distinguish them positionally). File addressing goes through the same resolution as set_breakpoint (Java FQCN passthrough, attach passthrough, container translation) but does not require the file to still exist.
  • clear_breakpoints {sessionId, file?} — whole session or one file; clearing zero is success.

All three deliberately work in TERMINATED lifecycle (unlike set_breakpoint): a terminated-but-unclosed session keeps its queued breakpoints so they can be inspected/adjusted between launches — groundwork for restart_debugging (#238). Only the live DAP sync is skipped. On live sessions, removal/clear re-send the file's remaining set immediately (DAP replace-all; empty array clears the file). A DAP failure never loses the store mutation — it surfaces as a warning.

Pipeline fixes underneath

  • syncBreakpointsForFile extraction — the replace-all re-send + positional response merge is now shared by set/remove/clear, and captures the adapter's breakpoint id into adapterId.
  • DAP breakpoint events were dropped entirely (MinimalDapClient emitted them; nobody listened). Now wired: connection-manager onBreakpoint → worker forward → typed ProxyManager event → session-manager listener that applies deferred verification/relocation, matching by adapterId with a (file, line) fallback. The fallback tolerates Windows drive-letter case differences — js-debug lowercases c:\. js-debug child-session events forward generically through the parent client, so child breakpoint events ride the same path.
  • Launch-time verified-state sync — the worker applies initialBreakpoints itself, but its setBreakpoints responses never reached the session store, so pre-launch breakpoints stayed verified:false forever on adapters that don't push breakpoint events (debugpy, Delve, rdbg, CodeLLDB...). After a successful launch, each breakpoint file is re-synced (replace-all with the identical set — idempotent), landing verified state and adapter ids in the store for every adapter and both launch paths (worker + js-debug handshake).

Tests

  • Unit (TDD throughout): adapterId capture, list/remove/clear semantics incl. empty-array re-send and TERMINATED store-only behavior, DAP-failure warning path, breakpoint-event application (id match, path fallback, case-insensitive Windows paths, unmatched ignored), event forwarding at connection-manager/worker/ProxyManager layers, launch-time sync, and new server-handler suite for the three tools. The Multi-Breakpoint DAP Aggregation harness now drives the real removeBreakpoint instead of hand-editing the map.
  • E2E: new tests/e2e/mcp-server-breakpoint-management.test.ts — language-parameterized across all 8 adapters (toolchain-skip for CI): set 2 bps → launch → paused → list shows verified + adapterId (polling: js-debug binds asynchronously) → remove the later bp by id → clear the rest → continue → program must run to completion, which fails if either the removal or the clear did not reach the adapter. 8/8 pass locally. Shared fixture/toolchain logic extracted to tests/e2e/language-matrix-utils.ts; comprehensive-mcp-tools now imports it and gains Tool 4b–4d steps (ALL_TOOLS 21 → 24; full suite green locally, 74/74 — the ruby get_output matrix cell soft-records a known-timing-sensitive marker miss unrelated to this change).
  • Dogfooded live via the dev proxy (Python): pause at bp → list (verified, adapterIds) → remove by id → clear → continue → clean exit, no re-stops.

Docs

tool-reference.md (3 new sections + stale-TOC repair), README tool table, usage.md, CLAUDE.md tool list (22 → 25), and both skill copies (src/skill-content.ts, skills/debugging/SKILL.md) — the "No breakpoint list/remove tools yet" limitation is gone, replaced by the move-the-bisection-window workflow.

🤖 Generated with Claude Code

cynarlab and others added 2 commits August 5, 2026 10:53
…t wiring

- Breakpoint model gains adapterId (adapter-assigned numeric id), captured
  from setBreakpoints responses in the positional merge.
- Extract syncBreakpointsForFile from setBreakpoint: shared replace-all
  re-send + response merge used by set/remove/clear. Never throws; DAP
  failures surface as a warning while the store stays authoritative.
- New SessionManager methods: listBreakpoints (sorted, optional file
  filter), removeBreakpoint (by id), removeBreakpointsByLocation
  (file+line, removes duplicates together), clearBreakpoints (one file or
  all). All deliberately work in TERMINATED lifecycle so breakpoints can
  be adjusted between launches; only the live DAP sync is skipped.
- Wire DAP breakpoint events end-to-end (previously dropped): connection
  manager onBreakpoint -> worker sendDapEvent -> typed ProxyManager
  breakpoint event -> session-manager listener that applies deferred
  verification/relocation (match by adapterId, fall back to file+line).
  js-debug child sessions forward events generically, so child breakpoint
  events surface through the same path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…y sync, docs

- Three new tools: list_breakpoints (sorted, optional file filter, count),
  remove_breakpoint (by id, or file+line removing all at that location),
  clear_breakpoints (session-wide or per file). All deliberately usable in
  TERMINATED lifecycle so breakpoints can be adjusted between launches;
  session-lifecycle errors surface as {success:false} like set_breakpoint.
- resolveBreakpointFile extracted from setBreakpoint and shared by the
  file-addressed forms (FQCN passthrough, attach passthrough, container
  translation); removal does not require the file to still exist.
- Post-launch breakpoint sync: the worker applies initialBreakpoints but its
  setBreakpoints responses never reached the session store, so pre-launch
  breakpoints stayed verified:false forever on adapters that do not push
  breakpoint events. After a successful launch each breakpoint file is
  re-synced (replace-all with the identical set, idempotent), landing
  verified state and adapter ids in the store for every adapter.
- Breakpoint-event path matching tolerates Windows drive-letter case
  differences (js-debug lowercases the drive letter).
- E2E: new language-parameterized suite mcp-server-breakpoint-management
  (8 languages, toolchain-skip; verification polling since js-debug binds
  asynchronously); shared tests/e2e/language-matrix-utils.ts extracted from
  comprehensive-mcp-tools; comprehensive suite gains Tool 4b-4d steps and
  its ALL_TOOLS list grows 21 -> 24.
- Docs: tool-reference sections + TOC repair, README table, usage.md,
  CLAUDE.md tool list 22 -> 25, skill copies drop the "no breakpoint
  list/remove tools" limitation and teach the bisection-window workflow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/server.ts 80.00% 14 Missing ⚠️
src/session/session-manager-core.ts 89.28% 3 Missing ⚠️
src/session/session-manager-operations.ts 97.40% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Breakpoint management: list_breakpoints / remove_breakpoint / clear_breakpoints tools

2 participants