Skip to content

Commit 1d63288

Browse files
authored
Revert "add add_comment tool support"
1 parent b26a0d0 commit 1d63288

2 files changed

Lines changed: 1 addition & 61 deletions

File tree

jadx_mcp_server.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
get_resource_file
3333
)
3434
from src.server.tools.refactor_tools import (
35-
rename_class, rename_method, rename_field, rename_package, rename_variable, add_comment
35+
rename_class, rename_method, rename_field, rename_package, rename_variable
3636
)
3737
from src.server.tools.debug_tools import (
3838
debug_get_stack_frames, debug_get_threads, debug_get_variables
@@ -222,12 +222,6 @@ async def rename_variable(class_name: str, method_name: str, variable_name: str,
222222
return await tools.refactor_tools.rename_variable(class_name, method_name, variable_name, new_name, reg, ssa)
223223

224224

225-
@mcp.tool()
226-
async def add_comment(target_type: str, class_name: str, comment: str, method_name: str = None, field_name: str = None, style: str = "LINE") -> dict:
227-
"""Adds a comment to a class, method, or field in the decompiled code with customizable comment style."""
228-
return await tools.refactor_tools.add_comment(target_type, class_name, comment, method_name, field_name, style)
229-
230-
231225
@mcp.tool()
232226
async def debug_get_stack_frames() -> dict:
233227
"""Get current stack frames (call stack)."""

src/server/tools/refactor_tools.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -118,57 +118,3 @@ async def rename_variable(class_name: str, method_name: str, variable_name: str,
118118
params["ssa"] = ssa
119119

120120
return await get_from_jadx("rename-variable", params)
121-
122-
123-
async def add_comment(target_type: str, class_name: str, comment: str, method_name: str = None, field_name: str = None, style: str = "LINE") -> dict:
124-
"""
125-
Adds a comment to a class, method, or field in the decompiled code.
126-
127-
Args:
128-
target_type: Type of target ("class", "method", or "field")
129-
class_name: Fully qualified class name
130-
comment: The comment text to add
131-
method_name (optional): Method name (required for method comments, can include full signature for overloaded methods)
132-
field_name (optional): Field name (required for field comments)
133-
style (optional): Comment style (default: "LINE")
134-
- "LINE": Single-line comment (// comment)
135-
- "BLOCK": Multi-line block comment (/* comment */)
136-
- "BLOCK_CONDENSED": Condensed block comment (/* comment */)
137-
- "JAVADOC": Javadoc style (/** comment */)
138-
- "JAVADOC_CONDENSED": Condensed Javadoc (/** comment */)
139-
140-
Returns:
141-
dict: Confirmation of comment addition with style information
142-
143-
MCP Tool: add_comment
144-
Description: Adds explanatory comments to decompiled code elements (classes, methods, or fields) with customizable comment styles
145-
146-
Examples:
147-
# Add single-line comment to a class (default style)
148-
add_comment("class", "com.example.MyClass", "This class handles user authentication")
149-
150-
# Add block comment to a method
151-
add_comment("method", "com.example.MyClass", "Validates user credentials\\nChecks password hash\\nReturns auth token",
152-
method_name="validateUser", style="BLOCK")
153-
154-
# Add Javadoc to overloaded method
155-
add_comment("method", "com.example.MyClass", "Validates user with email\\n@param email User email\\n@return true if valid",
156-
method_name="com.example.MyClass.validateUser(java.lang.String):boolean",
157-
style="JAVADOC")
158-
159-
# Add comment to a field
160-
add_comment("field", "com.example.MyClass", "User session token", field_name="sessionToken", style="LINE")
161-
"""
162-
params = {
163-
"target_type": target_type,
164-
"class_name": class_name,
165-
"comment": comment,
166-
"style": style
167-
}
168-
169-
if method_name:
170-
params["method_name"] = method_name
171-
if field_name:
172-
params["field_name"] = field_name
173-
174-
return await get_from_jadx("add-comment", params)

0 commit comments

Comments
 (0)