This document is the shared workflow source for AI agents using DebugTools through IntelliJ MCP tools.
DebugToolsMethodInvocationToolset:
list_debug_tools_connections- list current DebugTools connections already known to the IDE.list_attachable_jvms- list local JVM processes that can be attached.attach_local_jvm- attach the DebugTools agent to a local JVM process.generate_method_args_template- generate DebugToolsargsJsonfor a Java method from project PSI.invoke_java_method- invoke a Java method through an active DebugTools connection.get_debug_tools_status- aggregate project, connection, attachable JVM, debugger session, and capability status.read_target_application_logs- read recent logs from the selected target JVM ring buffer.get_last_sql_statements- read recent SQL from the target JVM or the IDEA SQL history fallback.search_http_url- query indexed HTTP endpoints as stable JSON metadata.search_symbol- look up a symbol name and get its file path with line range.search_text- literal text lookup in indexed project files.search_regex- regex lookup in indexed project files.search_file- file name lookup.get_file_problems- IDE-reported problems for one file.search_ide_actions- look up IDE actions by name.get_all_open_file_paths- files currently open or focused in the IDE.list_database_connections- list IDE-managed data sources with theirdbms.list_database_schemas- list schemas of one data source; Oracle schemas are uppercase.execute_sql_query- run one read-only SQL statement and return{resultSetId, text}with CSV-style text.
DebugToolsHotswapToolset:
list_debug_tools_run_configurations- list IntelliJ run configurations in the current project.execute_debug_tools_run_configuration- start a run configuration with the DebugTools Hotswap executor.compile_and_reload_modified_files- trigger IDEA Java Debugger Compile and Reload Modified Files for the HotSwap changed-file/class set.get_hotswap_operation- query a HotSwap operation after the initial request timed out or returned an operation id.run_and_invoke- orchestrate status, optional explicit start/attach, reload, invocation, and optional logs/SQL verification.
Use debug-tools-method-invocation for connection, attach, argument template, ClassLoader recovery, and Java method invocation tasks. Use debug-tools-hotswap for run configuration listing, Hotswap startup, and compile/reload tasks. Use debug-tools-spring-config when the user asks to read Spring runtime Environment configuration keys from an attached application. Use debug-tools-code-search for route, symbol, file, and IDE-problem lookup through the project index, and debug-tools-database-query for read-only SQL through IDE-configured data sources.
- Prefer
get_debug_tools_statuswhen the user asks for a complete diagnostic snapshot or when the target is not yet known. It exposesnextActionand candidate options without exposing connection headers. - If the user asks what is already connected, or before attaching by default, call
list_debug_tools_connections. - If a suitable active connection exists, reuse it. When exactly one active connection exists it may be selected automatically; when several exist, pass an explicit
connectionIdor ask the user to choose. - If no suitable connection exists, call
list_attachable_jvms. - If attachable JVMs are returned, ask only when multiple plausible JVMs match the user's target. Otherwise attach the obvious target with
attach_local_jvm. - If
list_attachable_jvmsreturnscount=0or an emptyjvmslist, calllist_debug_tools_run_configurationsand pass filters such asmoduleName,mainClassNameContains, ortypeDisplayNamewhen known. Offer only startup paths supported by actual context. - If only DebugTools Hotswap is known to be available, ask whether to start one with DebugTools Hotswap unless the user already authorized launch-if-needed behavior. If IDEA native Run/Debug is also known to be available from user context, tool output, or a future MCP capability, ask the user to choose between Hotswap and native Run/Debug.
- After any Hotswap startup request, follow
execute_debug_tools_run_configuration.nextAction. UseLIST_DEBUG_TOOLS_CONNECTIONSto re-check connections, orLIST_ATTACHABLE_JVMSto locate the started JVM and attach. Do not treatexecute_debug_tools_run_configuration.success=trueas proof that DebugTools is connected. - If the user chooses IDEA native Run/Debug, ask them to start the app in IDEA, then repeat connection discovery after they report startup is complete.
- For methods with parameters, call
generate_method_args_templatebefore manually writingargsJson, unless the exactargsJsonis already known. - Fill only the
contentvalues in the template unless the user explicitly wants to change parameter protocol types. - After a fresh attach or Hotswap startup, run the Spring readiness gate before invoking Spring-like
Controller,Service, repository, component, or bean methods. - Call
invoke_java_methodwithconnectionIdwhen there are multiple active connections. - If startup was authorized and manual attach is required, call
attach_local_jvmwithwaitForConnectionMillisso the result can provideconnectionIddirectly.
For method invocation, attach success only proves the DebugTools agent is present. It does not prove Spring has finished starting. When the selected target looks like a Spring method and the current turn just attached or just recovered from Hotswap startup, call:
GET http://<host>:<httpPort>/spring/readyUse only host and httpPort from the selected MCP connection. Do not guess localhost/default ports, scan ports, use /spring/config, or use Java method calls as readiness probes.
Polling rules:
- Fresh attach timeout:
30s. - Hotswap startup timeout:
60s. - Interval:
1s. ready=trueor HTTP200: proceed toinvoke_java_method.state=STARTINGandretryable=true: keep polling until ready or timeout.retryable=false: stop polling, report the state, and continue only if the user explicitly asks to force invocation.
Do not force this gate for obvious non-Spring static utility methods.
invoke_java_method.resultis the ToString view.resultViewis optional and defaults toTO_STRING. PassJSON,DEBUG, orNONEwhen the MCP result mode is requested explicitly.JSONandDEBUGare fetched by the plugin from the selected connection's existing result endpoints. The response includesresultJson,resultFetchStatus, andresultFetchErrorwhen applicable.- If result fetching fails, keep the method invocation outcome separate: the invocation can succeed while
resultFetchStatus=FAILED. Report the fetch error and retry only when useful. - Direct
POST /result/typeandPOST /result/detailremain a compatibility fallback when an older plugin does not exposeresultView, or when bounded Debug child expansion is needed. Usehost,httpPort, andoffsetPathfrom MCP output.
- If the user asks to read Spring configuration, use
debug-tools-spring-config. - Spring configuration reads are key-based direct DebugTools HTTP:
POST /spring/configwith a JSON string array of requested keys, usinghostandhttpPortfromlist_debug_tools_connections. - If the user does not provide keys, ask which Spring config keys to read. Do not try to dump all Spring configuration.
- Report values as Spring runtime Environment resolved values, not as direct
application.ymlorapplication.propertiesreads. - If
httpPortis missing, report that Spring config HTTP is unavailable.
Call compile_and_reload_modified_files when the task needs recent Java code changes loaded into an attached Java debugger session. Do not require an explicit user request when reload is the natural next step, and do not use git status to decide or restrict the scope. Pass waitMillis when bounded feedback is needed and retain the returned operationId if the request times out.
The "modified files" are IDEA Java Debugger HotSwap changed files/classes tracked since debugger session start or the previous reload. They are not VCS/git modified files. success=true means the request was submitted to IDEA; compile and HotSwap progress or failures are reported by IDEA's native UI/notifications. If the tool returns multiple availableSessionNames, choose the clear target or ask the user for the session name. Use get_hotswap_operation with operationId to query a pending request.
- Use
read_target_application_logsafter an invocation when the user asks what the target logged. PassconnectionIdwhen needed and uselimit,since,level, andkeywordto keep the response bounded.LOGS_UNAVAILABLEmeans the target could not provide log capability; it does not mean the log stream is empty. - Use
get_last_sql_statementsto inspect recent SQL from the target JVM ring buffer. The IDEA SQL history file remains available in the SQL History UI; the MCP tool reportsSQL_HISTORY_UNAVAILABLEwhen the target endpoint cannot provide data. - Use
search_http_urlfor path-to-controller discovery. It returns stable JSON and supports method, module, and limit filters; do not expect PSI or Swing navigation objects. - Use
run_and_invokewhen the user requests the full status → reload → invoke → logs/SQL loop. It may start or attach only whenallowStart=truewith an exactrunConfigurationName, orallowAttach=truewith an explicitpid. Never guess a run configuration or JVM from a fuzzy name.
New and enhanced tools use an error object with code, message, hint, availableOptions, retryable, nextAction, and details. Common codes include NO_PROJECT, CONNECTION_NOT_FOUND, CONNECTION_AMBIGUOUS, NO_CONNECTION, SESSION_AMBIGUOUS, SPRING_NOT_READY, HOTSWAP_FAILED, RESULT_FETCH_FAILED, LOGS_UNAVAILABLE, SQL_HISTORY_UNAVAILABLE, and TIMEOUT. Use availableOptions as the source for the next selection instead of parsing prose.
- Prefer an existing active connection over re-attaching.
- Use
connectionIdwhen more than one DebugTools connection exists. - Use
classLoaderIdentityonly when the user selected one, the current connection has a known default classloader, or the method requires a specific classloader. - ClassLoader discovery, Spring config reads, and Spring readiness checks are not MCP tools. When needed, use direct DebugTools HTTP from connection
hostandhttpPort. - Treat
list_attachable_jvmsas a discovery tool only; it does not prove a DebugTools connection exists. - Treat Hotswap startup as a recovery path for no active connection plus no attachable JVMs, not as the normal method invocation path.
- Do not always offer IDEA native Run/Debug startup. Include it only when actual user context, tool output, or a future MCP capability shows it is available.
- Prefer
generate_method_args_templatefor parameterized methods. - Preserve method declaration order.
- Use generated parameter names such as
nameandage; do not invent names. - If parameter names are unavailable, use ordered fallback keys such as
arg0andarg1. - Do not wrap
argsJsonintargetMethodContent. - If user values are missing for simple scalar parameters, safe sample values are acceptable when stated before invoking. Ask for values for complex arguments or methods likely to mutate external state.
Minimal argsJson example:
{
"name": { "type": "simple", "content": "codex" },
"age": { "type": "simple", "content": 18 }
}When a method is overloaded, pass parameterTypes in declaration order:
["java.lang.String", "java.lang.Integer"]If generate_method_args_template reports that parameterTypes are required, resolve the overload before invoking.
- If the user gives an exact IntelliJ run configuration name, call
execute_debug_tools_run_configurationwith thatconfigurationName. - If the name is missing, partial, or ambiguous, call
list_debug_tools_run_configurations; usemoduleName,mainClassNameContains, ortypeDisplayNamefilters when available. - Match the target by exact
namewhen possible. UsetypeName,typeDisplayName,mainClassName, andmoduleNameonly to disambiguate. - Ask the user to choose when multiple run configurations remain plausible.
- Treat
execute_debug_tools_run_configuration.success=trueas "startup was requested", not as proof that the JVM is running or DebugTools is connected. - If
requiresManualAttach=trueorautoAttachEnabled=false, do not assume DebugTools will attach automatically after launch. UsenextActionto continue the broader invocation workflow when startup was already authorized. - If the user then asks to inspect connections, attach, or invoke a Java method, switch to the method invocation flow.
No active DebugTools connection found: calllist_debug_tools_connections; attach if needed.- No attachable JVMs: call
list_debug_tools_run_configurations, offer only actually available startup paths, ask before Hotswap startup unless launch was explicitly authorized, then re-check connections before invoking. - Multiple active connections: choose the correct
connectionId. - Method not found: verify
className,methodName, andparameterTypes. - Parameters arrive as
null: verifyargsJsonis the top-level RunContentDTO map and is not wrapped intargetMethodContent. - Wrong class version or missing bean: inspect connection
defaultClassLoader; if needed, useGET /allClassLoaderandPOST /classLoader/hasClassthrough DebugTools HTTP, then pass the selected identity asclassLoaderIdentity. - Spring method fails immediately after attach or Hotswap startup: check
GET /spring/readyfirst. If it returnsSTARTINGwithretryable=true, wait instead of switching ClassLoaders or retrying unchanged. - Spring config key returns
null: report that Spring runtime Environment did not resolve that key instead of treating the HTTP call as failed. - Run configuration not found: call
list_debug_tools_run_configurationsor use returnedavailableConfigurationNamesto ask the user for the exact name. - Unsupported Hotswap runner: report that the run configuration does not support the DebugTools Hotswap executor instead of retrying unchanged.