JetBrains Debugger MCP
Use these tools to actually debug applications in a JetBrains IDE rather than guessing from static code.
Complete parameter reference: See references/tool-reference.md for all tool parameters, types, defaults, and return schemas.
When to Use the Debugger
USE the debugger when:
- A bug involves runtime state (wrong values, unexpected nulls, incorrect flow)
- Reading code alone doesn't explain the behavior
- The user asks "why does X happen" or "what value does Y have"
- A test fails and the cause isn't obvious from the assertion message
- You need to verify a hypothesis about execution flow
- The user explicitly asks to debug
DON'T use the debugger when:
- The bug is a clear syntax error, typo, or missing import
- The fix is obvious from reading the code (e.g., off-by-one, wrong operator)
- There's no run configuration available to debug
Core Workflow
Standard Debugging Sequence
1. list_run_configurations -- Find a config with can_debug: true
2. set_breakpoint -- Set breakpoint(s) BEFORE starting
3. start_debug_session -- Launch the debugger
4. wait_for_pause(timeout=60) -- Block until breakpoint hit (returns full status)
5. evaluate_expression -- Test hypotheses about values
6. step_over / step_into / step_out -- Navigate through code
7. wait_for_pause(timeout=10) -- Wait for step to complete, get state
8. resume_execution -- Continue to next breakpoint
9. wait_for_pause(timeout=60) -- Block until next breakpoint hit
10. stop_debug_session -- Clean up when done
Critical Rules
Set breakpoints BEFORE starting the session. Breakpoints can be set without an active session. Setting them first ensures the program pauses where you need it.
After resume_execution or any step command, use wait_for_pause to block until the session pauses. It returns the full session status (variables, stack, source, location) when the pause occurs — no polling needed. Step/resume commands return immediately with newState: "running" and do NOT wait for the program to pause.
Use get_debug_session_status to re-inspect state without waiting. It returns variables, stack trace, source context, and current location in ONE call. Do NOT call get_variables, get_stack_trace, and get_source_context separately unless you need specific parameters (e.g., a different frame index or more context lines).
Line numbers are 1-based. When setting breakpoints or using run_to_line, use the line numbers as they appear in the editor (starting from 1).
File paths must be absolute. For set_breakpoint, run_to_line, and get_source_context, always use absolute file paths (e.g., /Users/dev/project/src/Main.java). Files inside JARs are supported via the !/ separator (e.g. /path/to/lib-sources.jar!/com/example/Foo.kt).
session_id is optional for single-session debugging. When only one debug session exists, all tools auto-select it. Only specify session_id when multiple sessions are active.
project_path is required when multiple projects are open. If omitted with multiple projects, tools return an error listing available projects.
evaluate_expression may be safety-filtered by IDE settings. If a call is blocked, prefer get_variables, simple field/arithmetic expressions, or a narrower expression that avoids method calls and risky APIs. In non-Unrestricted modes, interpolated string templates (Kotlin ${...}, JS backticks, Python f-strings) are rejected outright — use plain references or concatenation instead. Breakpoint condition and log_message expressions pass through the same guard. Do not retry blocked process, filesystem, network, reflection, native-loading, or environment/system-property operations unless the user explicitly changes the IDE setting.
Debugging Patterns
Pattern: Find Why a Value is Wrong
1. set_breakpoint at the line where the wrong value is used
2. start_debug_session with the appropriate run configuration
3. wait_for_pause(timeout=60) -- blocks until breakpoint hit, returns full status
4. Inspect variables in the response -- the wrong value and its inputs are visible
5. evaluate_expression to test alternative calculations
6. If the value was already wrong here, set_breakpoint earlier in the call chain
7. resume_execution, then wait_for_pause(timeout=60) -- repeat
Pattern: Debug a Specific Loop Iteration
1. set_breakpoint with condition (e.g., condition: "i == 50")
2. start_debug_session
3. wait_for_pause(timeout=120) -- debugger runs at full speed until condition is true
4. Inspect variables in the response -- state at exactly iteration 50
Pattern: Trace Execution Without Stopping
1. set_breakpoint with log_message and suspend_policy: "none"
Example: log_message: "Entering process() with id={id}, count={items.size()}"
2. start_debug_session
3. resume_execution
4. Check IDE console output for trace log -- execution never pauses
Pattern: Inspect a Different Stack Frame
1. get_debug_session_status -- see the stack summary
2. select_stack_frame with the frame_index of interest (0 = current, 1 = caller, etc.)
3. get_variables -- now shows variables from the selected frame
4. evaluate_expression -- expressions evaluated in the selected frame's context
Pattern: Test a Fix Without Restarting
1. Pause at the point of interest
2. evaluate_expression with the corrected logic to verify it produces the right result
3. set_variable to inject the correct value
4. resume_execution to see if the fix resolves the downstream issue
Common Mistakes to Avoid
| Mistake |
Correct Approach |
Calling get_variables + get_stack_trace + get_source_context separately |
Use get_debug_session_status -- returns all three in one call |
| Starting debug session without setting breakpoints first |
Set breakpoints BEFORE start_debug_session |
Assuming step_over returns the new state |
Call wait_for_pause after stepping to block until paused and get the new state |
| Using 0-based line numbers |
Line numbers are 1-based (as shown in the editor) |
| Using relative file paths |
Always use absolute file paths |
Not waiting after resume_execution |
Use wait_for_pause to block until the next breakpoint is hit |
Calling evaluate_expression with method calls in Rust/C++/Go |
Use get_variables for native languages; method calls may fail in LLDB/GDB |
Using log_message {expr} placeholders in Rust/Go/Swift/C/C++ |
Rejected at set_breakpoint — those debuggers cannot evaluate them; use a plain message or a single bare {expr} |
Retrying an evaluate_expression blocked by safety settings |
Use get_variables or a simpler read-only expression; blocked categories are controlled by the user in IDE settings |
| Guessing variable values from source code |
Use the debugger to inspect actual runtime values |
Forgetting to stop_debug_session when done |
Always clean up debug sessions |
Language-Specific Notes
Full Support (Java, Kotlin, Python, JavaScript, TypeScript, PHP, Ruby)
- All tools work as documented
evaluate_expression supports method calls, field access, arithmetic
set_variable works for all types including objects and strings
Limited Support (Rust, C++, C, Go, Swift)
These use native debuggers (LLDB/GDB) with restrictions:
evaluate_expression: Variable inspection works, but method calls (e.g., s.len(), vec.size()) may fail
set_variable: Works for primitives (int, float, bool). Complex types (String, Vec, structs) may fail
- Workaround: Use
get_variables to inspect values instead of evaluate_expression with method calls
Tool Quick Reference
| Tool |
Purpose |
Requires Paused |
list_run_configurations |
Find debuggable configurations |
No |
execute_run_configuration |
Run or debug a configuration |
No |
start_debug_session |
Start debugging |
No |
stop_debug_session |
End debugging |
No |
list_debug_sessions |
See active sessions |
No |
get_debug_session_status |
Primary inspector -- variables, stack, source, location |
No (but most useful when paused) |
set_breakpoint |
Set line breakpoint (with optional condition/log) |
No |
remove_breakpoint |
Remove a breakpoint |
No |
list_breakpoints |
See all breakpoints |
No |
resume_execution |
Continue running |
Yes |
wait_for_pause |
Block until session pauses, return full status |
No |
pause_execution |
Pause running program |
No (must be running) |
step_over |
Next line (skip into functions) |
Yes |
step_into |
Enter function call |
Yes |
step_out |
Finish current function |
Yes |
run_to_line |
Run to specific line |
Yes |
get_stack_trace |
Full call stack |
Yes |
select_stack_frame |
Change frame context |
Yes |
list_threads |
See all threads |
Yes |
get_variables |
Variables in current frame |
Yes |
set_variable |
Modify a variable at runtime |
Yes |
get_source_context |
Source code around a location |
No |
evaluate_expression |
Evaluate any expression |
Yes |
1---2name: jetbrains-debugger3description: Guide for using JetBrains IDE Debugger MCP tools to programmatically debug applications. TRIGGER when ANY of these MCP tools are available: list_run_configurations, execute_run_configuration, start_debug_session, stop_debug_session, get_debug_session_status, list_debug_sessions, set_breakpoint, remove_breakpoint, list_breakpoints, resume_execution, pause_execution, step_over, step_into, step_out, run_to_line, wait_for_pause, get_stack_trace, select_stack_frame, list_threads, get_variables, set_variable, get_source_context, evaluate_expression. Use when debugging any application, investigating bugs, tracing execution flow, inspecting runtime state, or when the user says "debug", "breakpoint", "step through", "inspect variable", "why is this returning X", "trace execution", or similar debugging-related requests. PREFER the debugger over reading code and guessing when runtime behavior is unclear.4---56# JetBrains Debugger MCP78Use these tools to **actually debug** applications in a JetBrains IDE rather than guessing from static code.910**Complete parameter reference:** See [references/tool-reference.md](references/tool-reference.md) for all tool parameters, types, defaults, and return schemas.1112## When to Use the Debugger1314**USE the debugger when:**15- A bug involves runtime state (wrong values, unexpected nulls, incorrect flow)16- Reading code alone doesn't explain the behavior17- The user asks "why does X happen" or "what value does Y have"18- A test fails and the cause isn't obvious from the assertion message19- You need to verify a hypothesis about execution flow20- The user explicitly asks to debug2122**DON'T use the debugger when:**23- The bug is a clear syntax error, typo, or missing import24- The fix is obvious from reading the code (e.g., off-by-one, wrong operator)25- There's no run configuration available to debug2627## Core Workflow2829### Standard Debugging Sequence3031```321. list_run_configurations -- Find a config with can_debug: true332. set_breakpoint -- Set breakpoint(s) BEFORE starting343. start_debug_session -- Launch the debugger354. wait_for_pause(timeout=60) -- Block until breakpoint hit (returns full status)365. evaluate_expression -- Test hypotheses about values376. step_over / step_into / step_out -- Navigate through code387. wait_for_pause(timeout=10) -- Wait for step to complete, get state398. resume_execution -- Continue to next breakpoint409. wait_for_pause(timeout=60) -- Block until next breakpoint hit4110. stop_debug_session -- Clean up when done42```4344### Critical Rules45461. **Set breakpoints BEFORE starting the session.** Breakpoints can be set without an active session. Setting them first ensures the program pauses where you need it.47482. **After `resume_execution` or any step command, use `wait_for_pause` to block until the session pauses.** It returns the full session status (variables, stack, source, location) when the pause occurs — no polling needed. Step/resume commands return immediately with `newState: "running"` and do NOT wait for the program to pause.49503. **Use `get_debug_session_status` to re-inspect state without waiting.** It returns variables, stack trace, source context, and current location in ONE call. Do NOT call `get_variables`, `get_stack_trace`, and `get_source_context` separately unless you need specific parameters (e.g., a different frame index or more context lines).51524. **Line numbers are 1-based.** When setting breakpoints or using `run_to_line`, use the line numbers as they appear in the editor (starting from 1).53545. **File paths must be absolute.** For `set_breakpoint`, `run_to_line`, and `get_source_context`, always use absolute file paths (e.g., `/Users/dev/project/src/Main.java`). Files inside JARs are supported via the `!/` separator (e.g. `/path/to/lib-sources.jar!/com/example/Foo.kt`).55566. **`session_id` is optional for single-session debugging.** When only one debug session exists, all tools auto-select it. Only specify `session_id` when multiple sessions are active.57587. **`project_path` is required when multiple projects are open.** If omitted with multiple projects, tools return an error listing available projects.59608. **`evaluate_expression` may be safety-filtered by IDE settings.** If a call is blocked, prefer `get_variables`, simple field/arithmetic expressions, or a narrower expression that avoids method calls and risky APIs. In non-Unrestricted modes, interpolated string templates (Kotlin `${...}`, JS backticks, Python f-strings) are rejected outright — use plain references or concatenation instead. Breakpoint `condition` and `log_message` expressions pass through the same guard. Do not retry blocked process, filesystem, network, reflection, native-loading, or environment/system-property operations unless the user explicitly changes the IDE setting.6162## Debugging Patterns6364### Pattern: Find Why a Value is Wrong65```661. set_breakpoint at the line where the wrong value is used672. start_debug_session with the appropriate run configuration683. wait_for_pause(timeout=60) -- blocks until breakpoint hit, returns full status694. Inspect variables in the response -- the wrong value and its inputs are visible705. evaluate_expression to test alternative calculations716. If the value was already wrong here, set_breakpoint earlier in the call chain727. resume_execution, then wait_for_pause(timeout=60) -- repeat73```7475### Pattern: Debug a Specific Loop Iteration76```771. set_breakpoint with condition (e.g., condition: "i == 50")782. start_debug_session793. wait_for_pause(timeout=120) -- debugger runs at full speed until condition is true804. Inspect variables in the response -- state at exactly iteration 5081```8283### Pattern: Trace Execution Without Stopping84```851. set_breakpoint with log_message and suspend_policy: "none"86 Example: log_message: "Entering process() with id={id}, count={items.size()}"872. start_debug_session883. resume_execution894. Check IDE console output for trace log -- execution never pauses90```9192### Pattern: Inspect a Different Stack Frame93```941. get_debug_session_status -- see the stack summary952. select_stack_frame with the frame_index of interest (0 = current, 1 = caller, etc.)963. get_variables -- now shows variables from the selected frame974. evaluate_expression -- expressions evaluated in the selected frame's context98```99100### Pattern: Test a Fix Without Restarting101```1021. Pause at the point of interest1032. evaluate_expression with the corrected logic to verify it produces the right result1043. set_variable to inject the correct value1054. resume_execution to see if the fix resolves the downstream issue106```107108## Common Mistakes to Avoid109110| Mistake | Correct Approach |111|---------|-----------------|112| Calling `get_variables` + `get_stack_trace` + `get_source_context` separately | Use `get_debug_session_status` -- returns all three in one call |113| Starting debug session without setting breakpoints first | Set breakpoints BEFORE `start_debug_session` |114| Assuming `step_over` returns the new state | Call `wait_for_pause` after stepping to block until paused and get the new state |115| Using 0-based line numbers | Line numbers are **1-based** (as shown in the editor) |116| Using relative file paths | Always use **absolute** file paths |117| Not waiting after `resume_execution` | Use `wait_for_pause` to block until the next breakpoint is hit |118| Calling `evaluate_expression` with method calls in Rust/C++/Go | Use `get_variables` for native languages; method calls may fail in LLDB/GDB |119| Using `log_message` `{expr}` placeholders in Rust/Go/Swift/C/C++ | Rejected at `set_breakpoint` — those debuggers cannot evaluate them; use a plain message or a single bare `{expr}` |120| Retrying an `evaluate_expression` blocked by safety settings | Use `get_variables` or a simpler read-only expression; blocked categories are controlled by the user in IDE settings |121| Guessing variable values from source code | Use the debugger to inspect actual runtime values |122| Forgetting to `stop_debug_session` when done | Always clean up debug sessions |123124## Language-Specific Notes125126### Full Support (Java, Kotlin, Python, JavaScript, TypeScript, PHP, Ruby)127- All tools work as documented128- `evaluate_expression` supports method calls, field access, arithmetic129- `set_variable` works for all types including objects and strings130131### Limited Support (Rust, C++, C, Go, Swift)132These use native debuggers (LLDB/GDB) with restrictions:133- `evaluate_expression`: Variable inspection works, but method calls (e.g., `s.len()`, `vec.size()`) may fail134- `set_variable`: Works for primitives (int, float, bool). Complex types (String, Vec, structs) may fail135- **Workaround:** Use `get_variables` to inspect values instead of `evaluate_expression` with method calls136137## Tool Quick Reference138139| Tool | Purpose | Requires Paused |140|------|---------|:---:|141| `list_run_configurations` | Find debuggable configurations | No |142| `execute_run_configuration` | Run or debug a configuration | No |143| `start_debug_session` | Start debugging | No |144| `stop_debug_session` | End debugging | No |145| `list_debug_sessions` | See active sessions | No |146| `get_debug_session_status` | **Primary inspector** -- variables, stack, source, location | No (but most useful when paused) |147| `set_breakpoint` | Set line breakpoint (with optional condition/log) | No |148| `remove_breakpoint` | Remove a breakpoint | No |149| `list_breakpoints` | See all breakpoints | No |150| `resume_execution` | Continue running | **Yes** |151| `wait_for_pause` | Block until session pauses, return full status | No |152| `pause_execution` | Pause running program | No (must be running) |153| `step_over` | Next line (skip into functions) | **Yes** |154| `step_into` | Enter function call | **Yes** |155| `step_out` | Finish current function | **Yes** |156| `run_to_line` | Run to specific line | **Yes** |157| `get_stack_trace` | Full call stack | **Yes** |158| `select_stack_frame` | Change frame context | **Yes** |159| `list_threads` | See all threads | **Yes** |160| `get_variables` | Variables in current frame | **Yes** |161| `set_variable` | Modify a variable at runtime | **Yes** |162| `get_source_context` | Source code around a location | No |163| `evaluate_expression` | Evaluate any expression | **Yes** |