Skip to main content
Glama

ida_rename_multi_global_variables

Rename multiple global variables simultaneously in an IDA database by specifying old-to-new name pairs to streamline reverse engineering workflows.

Instructions

Rename multiple global variables at once in the IDA database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rename_pairs_old2newYes

Implementation Reference

  • Primary handler: implements multi global variable renaming by iterating over rename pairs and delegating to single rename helper.
    def rename_multi_global_variables(self, rename_pairs_old2new: List[Dict[str, str]]) -> Dict[str, Any]: """Rename multiple global variables at once""" try: success_count: int = 0 failed_pairs: List[Dict[str, str]] = [] for pair in rename_pairs_old2new: old_name = next(iter(pair.keys())) new_name = pair[old_name] # Call existing rename_global_variable_internal for each pair result = self._rename_global_variable_internal(old_name, new_name) if result.get("success", False): success_count += 1 else: failed_pairs.append({ "old_name": old_name, "new_name": new_name, "error": result.get("message", "Unknown error") }) return { "success": True, "message": f"Renamed {success_count} out of {len(rename_pairs_old2new)} global variables", "success_count": success_count, "failed_pairs": failed_pairs } except Exception as e: print(f"Error in rename_multi_global_variables: {str(e)}") traceback.print_exc() return { "success": False, "message": str(e), "success_count": 0, "failed_pairs": rename_pairs_old2new }
  • Core helper: performs single global variable rename using IDA API `ida_name.set_name` and refreshes views.
    def _rename_global_variable_internal(self, old_name: str, new_name: str) -> Dict[str, Any]: """Internal implementation for rename_global_variable without sync wrapper""" try: # Get variable address var_addr: int = ida_name.get_name_ea(0, old_name) if var_addr == idaapi.BADADDR: return {"success": False, "message": f"Variable '{old_name}' not found"} # Check if new name is already in use if ida_name.get_name_ea(0, new_name) != idaapi.BADADDR: return {"success": False, "message": f"Name '{new_name}' is already in use"} # Try to rename if not ida_name.set_name(var_addr, new_name): return {"success": False, "message": f"Failed to rename variable, possibly due to invalid name format or other IDA restrictions"} # Refresh view self._refresh_view_internal() return {"success": True, "message": f"Variable renamed from '{old_name}' to '{new_name}' at address {hex(var_addr)}"} except Exception as e: print(f"Error renaming variable: {str(e)}") traceback.print_exc() return {"success": False, "message": str(e)}
  • Pydantic model defining the input schema for the tool: list of old_name to new_name pairs.
    class RenameMultiGlobalVariables(BaseModel): rename_pairs_old2new: List[Dict[str, str]]
  • MCP tool registration in `server.list_tools()` with name, description, and input schema reference.
    Tool( name=IDATools.RENAME_MULTI_GLOBAL_VARIABLES, description="Rename multiple global variables at once in the IDA database", inputSchema=RenameMultiGlobalVariables.schema(),
  • Enum value in IDATools defining the exact tool name string 'ida_rename_multi_global_variables'.
    RENAME_MULTI_GLOBAL_VARIABLES = "ida_rename_multi_global_variables"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MxIris-Reverse-Engineering/ida-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server