Skip to main content
Glama

ida_get_function_decompiled_by_name

Retrieve decompiled pseudocode for a specific function by its name, enabling detailed analysis and integration with IDA database workflows.

Instructions

Get decompiled pseudocode for a function by name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
function_nameYes

Implementation Reference

  • MCP tool handler in call_tool that invokes the decompilation proxy function for the tool ida_get_function_decompiled_by_name
    case IDATools.GET_FUNCTION_DECOMPILED_BY_NAME: decompiled: str = ida_functions.get_function_decompiled_by_name(arguments["function_name"]) return [TextContent( type="text", text=decompiled )]
  • Proxy helper function in IDAProFunctions that sends socket request to IDA plugin to get decompiled code by function name
    def get_function_decompiled_by_name(self, function_name: str) -> str: """Get decompiled pseudocode for a function by its name""" try: response: Dict[str, Any] = self.communicator.send_request( "get_function_decompiled_by_name", {"function_name": function_name} ) # Log complete response for debugging self.logger.debug(f"Decompilation response: {response}") if "error" in response: return f"Error retrieving decompiled code for function '{function_name}': {response['error']}" decompiled_code: Any = response.get("decompiled_code") # Detailed type checking and conversion if decompiled_code is None: return f"Error: No decompiled code returned for function '{function_name}'" # Log actual type actual_type: str = type(decompiled_code).__name__ self.logger.debug(f"Decompiled code type is: {actual_type}") # Ensure result is string if not isinstance(decompiled_code, str): self.logger.warning(f"Decompiled code type is not string but {actual_type}, attempting conversion") try: decompiled_code = str(decompiled_code) except Exception as e: return f"Error: Failed to convert decompiled code from {actual_type} to string: {str(e)}" return f"Decompiled code for function '{function_name}':\n{decompiled_code}" except Exception as e: self.logger.error(f"Error getting function decompiled code: {str(e)}", exc_info=True) return f"Error retrieving decompiled code for function '{function_name}': {str(e)}"
  • Tool registration in @server.list_tools() using the enum value and schema
    Tool( name=IDATools.GET_FUNCTION_DECOMPILED_BY_NAME, description="Get decompiled pseudocode for a function by name", inputSchema=GetFunctionDecompiledByName.schema(), ),
  • Pydantic input schema model defining function_name parameter
    class GetFunctionDecompiledByName(BaseModel): function_name: str
  • Actual IDA Pro implementation handler in plugin core that decompiles the function using Hex-Rays and returns the pseudocode
    def get_function_decompiled_by_name(self, function_name: str) -> Dict[str, Any]: """Get decompiled code for a function by its name""" try: # Get function address from name func_addr = idaapi.get_name_ea(0, function_name) if func_addr == idaapi.BADADDR: return {"error": f"Function '{function_name}' not found"} # Call internal implementation without decorator result = self._get_function_decompiled_by_address_internal(func_addr) # If successful, add function name to result if "error" not in result: result["function_name"] = function_name return result except Exception as e: traceback.print_exc() return {"error": str(e)}

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