Skip to main content
Glama

ida_rename_function

Rename functions in IDA Pro databases to improve code readability and maintain reverse engineering workflows. Specify old and new function names to update the database.

Instructions

Rename a function in the IDA database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
old_nameYes
new_nameYes

Implementation Reference

  • Core implementation of function renaming using IDA Pro API (ida_name.set_name). This is the actual logic executed in IDA Pro.
    def rename_function(self, old_name: str, new_name: str) -> Dict[str, Any]:
        """Rename a function"""
        return self._rename_function_internal(old_name, new_name)
        
    def _rename_function_internal(self, old_name: str, new_name: str) -> Dict[str, Any]:
        """Internal implementation for rename_function without sync wrapper"""
        try:
            # Get function address
            func_addr: int = ida_name.get_name_ea(0, old_name)
            if func_addr == idaapi.BADADDR:
                return {"success": False, "message": f"Function '{old_name}' not found"}
            
            # Check if it's a function
            func: Optional[ida_funcs.func_t] = ida_funcs.get_func(func_addr)
            if not func:
                return {"success": False, "message": f"'{old_name}' is not a function"}
            
            # 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(func_addr, new_name):
                return {"success": False, "message": f"Failed to rename function, possibly due to invalid name format or other IDA restrictions"}
            
            # Refresh view
            self._refresh_view_internal()
            
            return {"success": True, "message": f"Function renamed from '{old_name}' to '{new_name}' at address {hex(func_addr)}"}
        
        except Exception as e:
            print(f"Error renaming function: {str(e)}")
            traceback.print_exc()
            return {"success": False, "message": str(e)}
  • MCP server-side handler that proxies the rename request to the IDA Pro plugin via socket communication.
    def rename_function(self, old_name: str, new_name: str) -> str:
        """Rename a function"""
        try:
            response: Dict[str, Any] = self.communicator.send_request(
                "rename_function", 
                {"old_name": old_name, "new_name": new_name}
            )
            
            if "error" in response:
                return f"Error renaming function from '{old_name}' to '{new_name}': {response['error']}"
            
            success: bool = response.get("success", False)
            message: str = response.get("message", "")
            
            if success:
                return f"Successfully renamed function from '{old_name}' to '{new_name}': {message}"
            else:
                return f"Failed to rename function from '{old_name}' to '{new_name}': {message}"
        except Exception as e:
            self.logger.error(f"Error renaming function: {str(e)}", exc_info=True)
            return f"Error renaming function from '{old_name}' to '{new_name}': {str(e)}"
  • Registration of the 'ida_rename_function' tool in the MCP server's list_tools() function.
    Tool(
        name=IDATools.RENAME_FUNCTION,
        description="Rename a function in the IDA database",
        inputSchema=RenameFunction.schema(),
    ),
  • Pydantic input schema for the 'ida_rename_function' tool defining old_name and new_name parameters.
    class RenameFunction(BaseModel):
        old_name: str
        new_name: str
  • Request dispatcher in IDA plugin that routes 'rename_function' requests to the core implementation.
    elif request_type == "rename_function":
        response.update(self.core.rename_function(
            request_data.get("old_name", ""),
            request_data.get("new_name", "")
        ))
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but lacks behavioral details. It states the action is a rename but does not disclose effects like whether changes are permanent, require specific permissions, or affect related data (e.g., references). This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with no wasted words, making it easy to parse. It is appropriately sized for the tool's complexity and front-loads the core action effectively.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations, no output schema, and 2 parameters, the description is incomplete. It lacks details on behavior, side effects, error conditions, or return values, leaving significant gaps for an AI agent to understand the tool fully.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description implies parameters for old and new names, aligning with the schema's two parameters. With 0% schema description coverage, it adds meaningful context by indicating the tool renames a function, though it does not detail format constraints or examples. For 2 parameters, this provides adequate semantic value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Rename') and target resource ('a function in the IDA database'), making the purpose immediately understandable. It distinguishes from some siblings like comment or get tools, though not explicitly from other rename tools (e.g., ida_rename_global_variable).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description does not mention prerequisites, when-not scenarios, or differentiate from similar rename tools (e.g., ida_rename_multi_functions for batch operations), leaving usage context unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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