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)}
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but lacks critical details: it doesn't specify if this is a read-only operation, what happens if the cursor isn't in a function, the format of the returned assembly, or any error conditions. This leaves significant gaps in understanding the tool's behavior.

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, efficient sentence that directly states the tool's purpose without any fluff. It's front-loaded with the core action and target, making it easy to parse quickly.

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?

Given the complexity of assembly code retrieval and the lack of annotations and output schema, the description is insufficient. It doesn't explain what 'assembly code' entails (e.g., raw bytes, disassembly, formatting), error handling, or dependencies on cursor state, leaving the agent with incomplete context for reliable use.

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 tool has zero parameters, and the input schema has 100% coverage (though empty). The description doesn't need to explain parameters, so it meets the baseline expectation. No additional parameter information is required or provided.

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 ('Get assembly code') and target ('for the function at the current cursor position'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish itself from sibling tools like 'ida_get_function_assembly_by_address' or 'ida_get_function_assembly_by_name', which offer similar functionality through different selection mechanisms.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., requiring a cursor to be positioned within a function), nor does it compare with siblings that fetch assembly by address or name, leaving the agent to infer usage context from tool names alone.

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