get_binary_info
Extract binary metadata such as file structure, symbols, and sections from executable files using Binary Ninja's analysis capabilities through the Cline MCP Server.
Instructions
Get binary metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Implementation Reference
- binaryninja_server.py:293-315 (handler)Main handler for the 'get_binary_info' MCP tool. Extracts path parameter, fetches file information from BinaryNinjaHTTPClient, formats it into a structured response including filename, architecture, platform, entry point, size, etc., and returns it.elif method == "get_binary_info": path = params.get("path") if not path: return {"error": "Path parameter is required"} # We assume the binary is already loaded # Just log the path for debugging logger.info(f"Using binary: {path}") file_info = client.get_file_info(path) # Format the response to match the original API info = { "filename": file_info.get("filename", ""), "architecture": file_info.get("arch", {}).get("name", "unknown"), "platform": file_info.get("platform", {}).get("name", "unknown"), "entry_point": hex(file_info.get("entry_point", 0)), "file_size": file_info.get("file_size", 0), "is_executable": file_info.get("executable", False), "is_relocatable": file_info.get("relocatable", False), "address_size": file_info.get("address_size", 0) } return {"result": info}
- binaryninja_server.py:53-65 (schema)Input schema definition for the 'get_binary_info' tool in the list_tools response. Defines 'path' as required string parameter.{ "name": "get_binary_info", "description": "Get information about a binary file", "inputSchema": { "type": "object", "properties": { "path": { "type": "string", "description": "Path to the binary file" } }, "required": ["path"] }
- binaryninja_mcp_http_server.py:304-315 (handler)HTTP MCP handler for 'get_binary_info'. Validates path parameter, calls client.get_file_info, wraps result as MCP content.elif method == "get_binary_info": path = params.get("path") if not path: logger.error("Missing 'path' parameter") return self._error_response(request_id, -32602, "Missing 'path' 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") logger.debug(f"Getting info for file: {path}") info = self.client.get_file_info(path) return self._wrap_result(request_id, json.dumps(info, indent=2))
- binaryninja_mcp_http_server.py:24-31 (schema)Tool registration and schema in MCP_TOOLS list for 'get_binary_info', defining input as object with required 'path' string."name": "get_binary_info", "description": "Get binary metadata", "streaming": False, "inputSchema": { "type": "object", "properties": {"path": {"type": "string"}}, "required": ["path"] }
- binaryninja_http_server.py:62-80 (handler)Simplified stdin MCP handler for 'get_binary_info', similar to binaryninja_server.py, formats and returns binary info.elif method == "get_binary_info": path = params.get("path") if not path: return {"error": "Path parameter is required"} file_info = client.get_file_info(path) # Format the response to match the original API info = { "filename": file_info.get("filename", ""), "architecture": file_info.get("arch", {}).get("name", "unknown"), "platform": file_info.get("platform", {}).get("name", "unknown"), "entry_point": hex(file_info.get("entry_point", 0)), "file_size": file_info.get("file_size", 0), "is_executable": file_info.get("executable", False), "is_relocatable": file_info.get("relocatable", False), "address_size": file_info.get("address_size", 0) } return {"result": info}