debug
Launch and control debug sessions for multiple programming languages using the Debug Adapter Protocol. Set breakpoints, step through code, inspect variables, and evaluate expressions to identify and fix issues.
Instructions
Interactive debugger using Debug Adapter Protocol (DAP). Launch and control debug sessions for any language with a DAP-compatible adapter. Supports breakpoints, stepping, variable inspection, expression evaluation, stack traces. Adapters: dlv (Go), debugpy (Python), codelldb/lldb-dap (C/C++/Rust), and more. Operations: launch, attach, set_breakpoints, continue, next, step_in, step_out, pause, threads, stack_trace, scopes, variables, evaluate, disconnect, status. Extended: breakpoint_locations, set_function_breakpoints, set_exception_breakpoints, set_data_breakpoints, data_breakpoint_info, set_instruction_breakpoints, disassemble, read_memory, write_memory, set_variable, set_expression, goto, goto_targets, step_back, reverse_continue, restart_frame, modules, loaded_sources, exception_info, completions, source, terminate, restart, cancel, step_in_targets, terminate_threads, resolve_address. Requires a DAP adapter executable installed on the system (e.g. 'dlv dap' for Go, 'python -m debugpy' for Python).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | No | Debug session ID. Auto-generated if empty on launch | |
| operation | Yes | Debug operation: launch, attach, set_breakpoints, continue, next, step_in, step_out, pause, threads, stack_trace, scopes, variables, evaluate, disconnect, status, set_function_breakpoints, set_exception_breakpoints, set_data_breakpoints, data_breakpoint_info, set_instruction_breakpoints, disassemble, read_memory, write_memory, set_variable, set_expression, goto, goto_targets, step_back, reverse_continue, restart_frame, modules, loaded_sources, exception_info, completions, source, terminate, restart, cancel, step_in_targets, terminate_threads, resolve_address,required | |
| adapter_command | No | Debug adapter executable path or command (e.g. dlv, debugpy, codelldb) | |
| adapter_args | No | Debug adapter command arguments (e.g. [dap] for dlv) | |
| address | No | Debug adapter TCP address host:port (for TCP mode, Phase 2) | |
| launch_args | No | JSON object with launch configuration passed to the adapter (program path, args, env, cwd, etc.). Keys starting with __ are meta fields consumed by this tool and not forwarded to the adapter. Use help(topic=debug) for adapter-specific recipes. | |
| client_id | No | DAP client identifier sent in initialize. Default: agent-tool. Set to vscode for vsdbg compatibility. | |
| client_name | No | DAP client display name sent in initialize. Default: agent-tool MCP debug client | |
| source_path | No | Absolute source file path for breakpoints | |
| breakpoints | No | JSON array of breakpoints: [{line: N, condition: '...', hit_condition: '...', log_message: '...'}] | |
| filters | No | JSON array of exception filter IDs for set_exception_breakpoints (e.g. ["raised","uncaught"]) | |
| thread_id | No | Thread ID (for stack_trace, continue, next, step_in, step_out, pause, goto, step_back, reverse_continue, exception_info). Default: 1 | |
| frame_id | No | Stack frame ID (for scopes, evaluate, set_expression, restart_frame, step_in_targets, completions) | |
| variables_reference | No | Variables reference ID from scopes response (for variables, set_variable, data_breakpoint_info) | |
| expression | No | Expression to evaluate in the debug context | |
| context | No | Evaluation context: watch, repl, hover. Default: repl | |
| name | No | Variable name (for set_variable, data_breakpoint_info) | |
| value | No | New value (for set_variable, set_expression) | |
| target_id | No | Target ID for goto (from goto_targets response) | |
| line | No | Line number (for goto_targets, completions) | |
| column | No | Column number (for goto_targets, completions) | |
| text | No | Text for completions request | |
| memory_reference | No | Memory reference address (for disassemble, read_memory, write_memory) | |
| count | No | Byte count (read_memory) or instruction count (disassemble) | |
| instruction_offset | No | Instruction offset relative to memory_reference (disassemble) | |
| resolve_symbols | No | Resolve symbols in disassembly output | |
| data | No | Base64-encoded data (write_memory) | |
| source_reference | No | Source reference ID (for source request, from stack frame) | |
| start_module | No | Start index for modules paging | |
| module_count | No | Number of modules to return (0 = all) | |
| thread_ids | No | JSON array of thread IDs to terminate (for terminate_threads) | |
| request_id | No | Pending request ID to cancel | |
| timeout_sec | No | Operation timeout in seconds. Default: 30, Max: 120 |