Skip to content

Conversation

badmonkey7
Copy link
Contributor

Added renaming function and optimized subclass search logic

Pull Request

Summary of Changes

when fetch the source code of subclass such "a$b",the origin logic doesn't work.So I update code and add Class 、Method、Field rename functions.

image

The python mcp server also need to be updated,but that file is not in the repo.So I paste code below

@mcp.tool(name="rename_class", description="rename specific class name to one better understanding name,input class name must contain package name")
async def rename_class(class_name: str, new_name: str):
    """Renames a specific class.

    Args:
        class_name (str): The full name of the class to be renamed, including package name.
        new_name (str): The new name for the class.

    Returns:
        dict: The response from the JADX server.
    """
    return await get_from_jadx("rename-class", {"class": class_name, "newName": new_name})

@mcp.tool(name="rename_method", description="rename specific method name to one better understanding name,input method name must contain package name and class name")
async def rename_method(method_name: str, new_name: str):
    """Renames a specific method.

    Args:
        method_name (str): The full name of the method to be renamed, including package and class name.
        new_name (str): The new name for the method.

    Returns:
        dict: The response from the JADX server.
    """
    return await get_from_jadx("rename-method", {"method": method_name, "newName": new_name})

@mcp.tool(name="rename_field", description="rename specific field name to one better understanding name,must input full class name and field name")
async def rename_field(class_name: str,field_name: str, new_name: str):
    """Renames a specific field.

    Args:
        class_name (str): The full class name of field
        field_name (str): The field to be rename.
        new_name (str): The new name for the field.

    Returns:
        dict: The response from the JADX server.
    """
    return await get_from_jadx("rename-field", {"class": class_name, "field":field_name,"newFieldName": new_name})

Added renaming function and optimized subclass search logic
@zinja-coder zinja-coder merged commit 0e03e51 into zinja-coder:jadx-ai Jul 31, 2025
@zinja-coder
Copy link
Owner

Thank you for this.

zinja-coder added a commit to zinja-coder/jadx-mcp-server that referenced this pull request Jul 31, 2025
Co-authored-by: badmonkey <badmonkey7@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants