Skip to main content
Glama
opensensor

Binary Ninja Cline MCP Server

by opensensor

disassemble_function

Analyze binary files by extracting and displaying the assembly code of specific functions to understand program behavior.

Instructions

Disassemble a function from a binary

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
functionYes

Implementation Reference

  • Input schema definition for the disassemble_function tool in the list_tools MCP method response.
    "name": "disassemble_function",
    "description": "Disassemble a function in a binary file",
    "inputSchema": {
        "type": "object",
        "properties": {
            "path": {
                "type": "string",
                "description": "Path to the binary file"
            },
            "function": {
                "type": "string",
                "description": "Name of the function to disassemble"
            }
        },
        "required": ["path", "function"]
    }
  • Registration and dispatching of call_tool 'disassemble_function' to the internal method handler.
    elif tool_name == "disassemble_function":
        return handle_request({
            "method": "disassemble_function",
            "params": tool_args
        }, client)
  • Core handler for the disassemble_function MCP method: validates params, calls BinaryNinjaHTTPClient.get_disassembly, returns disassembly lines.
    elif method == "disassemble_function":
        path = params.get("path")
        func_name = params.get("function")
        if not path or not func_name:
            return {"error": "Path and function parameters are required"}
            
        # We assume the binary is already loaded
        # Just log the path for debugging
        logger.info(f"Using binary: {path}")
            
        disasm = client.get_disassembly(path, function_name=func_name)
        return {"result": disasm}
  • HTTP MCP server handler for disassemble_function with JSON-RPC error handling and response wrapping.
    elif method == "disassemble_function":
        path = params.get("path")
        func = params.get("function")
        if not path:
            logger.error("Missing 'path' parameter")
            return self._error_response(request_id, -32602, "Missing 'path' parameter")
        if not func:
            logger.error("Missing 'function' parameter")
            return self._error_response(request_id, -32602, "Missing 'function' parameter")
        if not isinstance(path, str):
            logger.error(f"Invalid path type: {type(path)}")
            return self._error_response(request_id, -32602, "Parameter 'path' must be a string")
        if not isinstance(func, str):
            logger.error(f"Invalid function type: {type(func)}")
            return self._error_response(request_id, -32602, "Parameter 'function' must be a string")
        
        logger.debug(f"Disassembling function {func} in file: {path}")
        code = self.client.get_disassembly(path, function_name=func)
        return self._wrap_result(request_id, "\n".join(code))
  • Helper method implementing the disassembly logic by searching functions and providing function info + decompiled HLIL as pseudo-disassembly via Binary Ninja HTTP API.
    def get_disassembly(self, file_path=None, function_name=None, function_address=None):
        """Get the disassembly of a specific function."""
        try:
            # Get function info first to get the address
            identifier = function_name if function_name else function_address
            if identifier is None:
                return ["No function identifier provided"]
                
            # Convert to string if it's not already
            if not isinstance(identifier, str):
                identifier = str(identifier)
                
            # Use the function info endpoint to get the function details
            # Since there's no direct disassembly endpoint, we'll use the function info
            # and format it as disassembly lines
            try:
                # First try to get function info
                response = self._request('GET', 'searchFunctions', params={"query": identifier})
                matches = response.get("matches", [])
                
                if not matches:
                    return [f"Function '{identifier}' not found"]
                
                # Get the first match
                func = matches[0]
                
                # Format the function info as disassembly lines
                disasm = []
                disasm.append(f"Function: {func.get('name', 'unknown')}")
                disasm.append(f"Address: {func.get('address', '0x0')}")
                
                # Try to get the decompiled code to show as pseudo-disassembly
                try:
                    decompiled = self.get_hlil(file_path, function_name=func.get('name'))
                    if decompiled and decompiled != "No decompilation available":
                        disasm.append("Decompiled code:")
                        for line in decompiled.split("\n"):
                            disasm.append(f"  {line}")
                except Exception:
                    pass
                
                return disasm
            except Exception as e:
                logger.warning(f"Failed to get function info: {e}")
                return [f"Error getting disassembly: {e}"]
        except Exception as e:
            logger.error(f"Failed to get disassembly: {e}")
            raise
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but lacks critical behavioral details: it doesn't specify if this is a read-only operation, what permissions are needed, how errors are handled, or what the output format looks like. The description is functional but incomplete for safe agent use.

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 states the core purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent 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 disassembling functions from binaries, no annotations, no output schema, and 0% schema description coverage, the description is inadequate. It doesn't explain what the tool returns, error conditions, or behavioral constraints, leaving the agent with insufficient context for reliable use.

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

Parameters2/5

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

The schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions 'a function from a binary' which hints at the 'function' parameter, but doesn't explain what 'path' refers to (e.g., file path, binary identifier) or provide any format details. This leaves significant gaps in parameter understanding.

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 ('disassemble') and target ('a function from a binary'), which is specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'decompile_function' or 'list_functions', which would be needed for a perfect score.

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 like 'decompile_function' or 'list_functions'. There's no mention of prerequisites, context, or exclusions, leaving the agent to infer usage based on 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/opensensor/bn_cline_mcp'

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