| name | debug-tools-method-invocation |
|---|---|
| description | Use when operating DebugTools IntelliJ MCP tools for Java method invocation, JVM attachment, connection discovery, argsJson template generation, classloader selection, overloaded methods, or failures involving list_debug_tools_connections, list_attachable_jvms, attach_local_jvm, generate_method_args_template, invoke_java_method, no attachable JVMs, or Hotswap startup fallback through list_debug_tools_run_configurations and execute_debug_tools_run_configuration. |
Use DebugTools as a live Java method invocation bridge. The workflow is MCP-first: choose the IntelliJ project, find or attach a DebugTools connection, prepare arguments, then invoke. Use local process commands only when the user explicitly asks for diagnostics.
Method invocation tools:
list_debug_tools_connectionslist_attachable_jvmsattach_local_jvmgenerate_method_args_templateinvoke_java_method
Startup recovery tools, used only when no active connection and no attachable JVMs are available:
list_debug_tools_run_configurationsexecute_debug_tools_run_configuration
- If the DebugTools MCP tools are not exposed in the current Codex tool context, stop and report a configuration error. Do not fall back to shell process inspection, local startup, direct HTTP probing, reflection runners, or Java/Maven commands for discovery or invocation.
- Direct DebugTools HTTP is allowed only after MCP has returned a selected connection with
hostandhttpPort, and only for documented companion endpoints: Spring readiness, ClassLoader checks, and JSON/Debug result views. GET /spring/readyis a DebugTools companion HTTP endpoint, not an MCP tool. Use only the selected MCP connectionhostandhttpPort; do not guess127.0.0.1:22222, scan ports, or useps/jpsas a substitute for MCP connection selection.- Do not invent MCP tools or parameters such as
list_debug_tools_classloaders,resultFormats,debugDepth, or result-view MCP fields.
- Infer
projectPathfrom the target source path or workspace when possible. If MCP reports ambiguous open projects, retry the same MCP call with the inferred project. - Call
list_debug_tools_connectionsbefore attaching unless the user gave a fresh PID. - Reuse a matching active connection. If multiple connections are plausible, pass
connectionId; ask only when metadata cannot disambiguate. - If no suitable connection exists, call
list_attachable_jvms, select a PID, thenattach_local_jvm. Use boundedwaitForConnectionMilliswhen attach is part of an authorized invocation workflow. - If no JVMs are attachable, read
references/workflow.mdfor Hotswap startup recovery usinglist_debug_tools_run_configurationsandexecute_debug_tools_run_configuration. - Prepare parameters: omit
argsJsonfor no-arg methods, build simple known values directly, and usegenerate_method_args_templatefor complex args, uncertain names, generated defaults, or overloads. - Before invoking a Spring-like target after a fresh
attach_local_jvmor Hotswap startup recovery, run the Readiness Gate below. - Call
invoke_java_methodwithclassName,methodName, plusprojectPath,connectionId,parameterTypes,argsJson, orclassLoaderIdentityonly when needed. - If invocation fails, recover from the specific error instead of retrying unchanged; see
references/troubleshooting.md.
Use this gate only when the selected method appears to depend on Spring runtime state, such as a Controller, Service, repository, component, or bean method. Do not force it for obvious non-Spring static utility methods.
Run the gate when either condition is true:
- This turn just attached with
attach_local_jvmand MCP returned a connection withhostandhttpPort. - This turn just started through DebugTools Hotswap, then rediscovered or attached a connection before invocation.
Call:
GET http://<host>:<httpPort>/spring/readyPolling rules:
- Use the selected MCP connection
hostandhttpPortonly. - Poll every
1s. - Use timeout
30safter fresh attach. - Use timeout
60safter Hotswap startup. - Continue to
invoke_java_methodwhenready=trueor HTTP status is200. - If
state=STARTINGandretryable=true, keep polling until ready or timeout. - If
retryable=false, stop polling and report thestateand reason. Continue only if the user explicitly asks to force invocation.
Usually omit classLoaderIdentity. Use it only when the user selected a loader, the connection reports a suitable default loader, or errors indicate class-not-found, bean resolution, framework-context, or wrong-class-version problems.
ClassLoader discovery is direct DebugTools HTTP after MCP connection discovery, not an MCP tool. Use GET /allClassLoader and POST /classLoader/hasClass; if multiple loaders match, ask the user to choose. See references/http-classloader.md.
invoke_java_method.resultis the ToString view.- For JSON output, call direct DebugTools HTTP
POST /result/typewithprintResultType=Json, using connectionhost/httpPortand invocationoffsetPath. - For Debug view or object-field inspection, call
POST /result/typewithprintResultType=Debug. - For Debug expansion, call
POST /result/detailwith the selected node'sfiledOffsetas requestoffsetPath. ThefiledOffsetspelling matches the current DebugTools protocol. - If
httpPortoroffsetPathis missing, report that JSON/Debug result view HTTP is unavailable. - See
references/http-result-view.mdfor request shapes and expansion limits.
argsJson is a JSON object whose values are RunContentDTO objects, not a wrapper around targetMethodContent.
{
"name": { "type": "simple", "content": "codex" },
"age": { "type": "simple", "content": 18 }
}Preserve generated parameter keys and declaration order. Use arg0, arg1, arg2 only when reliable names are unavailable. For complex values or type choices, read references/args-json.md.
references/workflow.md- connection selection, startup recovery, parameters, ClassLoader flow.references/args-json.md- RunContentDTO shapes and template editing.references/http-classloader.md- direct HTTP ClassLoader checks.references/http-result-view.md- direct HTTP JSON and Debug result views.references/troubleshooting.md- recovery by failure symptom.