Skip to main content
Glama

ida_get_current_function_assembly

Retrieve assembly code for the function at your current cursor position in IDA Pro to analyze and understand its structure.

Instructions

Get assembly code for the function at the current cursor position

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the MCP tool 'ida_get_current_function_assembly' in the list_tools() function with description and empty input schema.
    @server.list_tools() async def list_tools() -> List[Tool]: """List supported tools""" return [ Tool( name=IDATools.GET_FUNCTION_ASSEMBLY_BY_NAME, description="Get assembly code for a function by name", inputSchema=GetFunctionAssemblyByName.schema(), ), Tool( name=IDATools.GET_FUNCTION_ASSEMBLY_BY_ADDRESS, description="Get assembly code for a function by address", inputSchema=GetFunctionAssemblyByAddress.schema(), ), Tool( name=IDATools.GET_FUNCTION_DECOMPILED_BY_NAME, description="Get decompiled pseudocode for a function by name", inputSchema=GetFunctionDecompiledByName.schema(), ), Tool( name=IDATools.GET_FUNCTION_DECOMPILED_BY_ADDRESS, description="Get decompiled pseudocode for a function by address", inputSchema=GetFunctionDecompiledByAddress.schema(), ), Tool( name=IDATools.GET_GLOBAL_VARIABLE_BY_NAME, description="Get information about a global variable by name", inputSchema=GetGlobalVariableByName.schema(), ), Tool( name=IDATools.GET_GLOBAL_VARIABLE_BY_ADDRESS, description="Get information about a global variable by address", inputSchema=GetGlobalVariableByAddress.schema(), ), Tool( name=IDATools.GET_CURRENT_FUNCTION_ASSEMBLY, description="Get assembly code for the function at the current cursor position", inputSchema=GetCurrentFunctionAssembly.schema(), ),
  • Pydantic input schema for the tool (no parameters required).
    class GetCurrentFunctionAssembly(BaseModel): pass
  • MCP tool handler in call_tool() that calls the IDAProFunctions wrapper and returns the assembly as text content.
    case IDATools.GET_CURRENT_FUNCTION_ASSEMBLY: assembly: str = ida_functions.get_current_function_assembly() return [TextContent( type="text", text=assembly )]
  • Wrapper function in IDAProFunctions that sends socket request 'get_current_function_assembly' to IDA plugin and formats the response.
    def get_current_function_assembly(self) -> str: """Get assembly code for the function at current cursor position""" try: response: Dict[str, Any] = self.communicator.send_request( "get_current_function_assembly", {} ) if "error" in response: return f"Error retrieving assembly for current function: {response['error']}" assembly: Any = response.get("assembly") function_name: str = response.get("function_name", "Current function") # Verify assembly is string type if assembly is None: return f"Error: No assembly data returned for current function" if not isinstance(assembly, str): self.logger.warning(f"Assembly data type is not string but {type(assembly).__name__}, attempting conversion") assembly = str(assembly) return f"Assembly code for function '{function_name}':\n{assembly}" except Exception as e: self.logger.error(f"Error getting current function assembly: {str(e)}", exc_info=True) return f"Error retrieving assembly for current function: {str(e)}"
  • Core IDA handler function that gets the current screen EA and retrieves assembly using internal helper.
    def get_current_function_assembly(self) -> Dict[str, Any]: """Get assembly code for the function at the current cursor position""" try: # Get current address curr_addr = idaapi.get_screen_ea() if curr_addr == idaapi.BADADDR: return {"error": "No valid cursor position"} # Use the internal implementation without decorator return self._get_function_assembly_by_address_internal(curr_addr) 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