list_functions
Extract and display function names from binary files to analyze program structure and identify key components.
Instructions
List functions in a binary
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Implementation Reference
- binaryninja-mcp-bridge.js:140-149 (handler)MCP CallToolRequest handler case for list_functions tool: parses input arguments using FilePathSchema and calls the Binary Ninja HTTP server.case "list_functions": { try { const args = FilePathSchema.parse(request.params.arguments); result = await callBinaryNinjaServer("list_functions", args); } catch (error) { console.error(`[ERROR] Failed to parse arguments for list_functions: ${error.message}`); console.error(`[ERROR] Arguments received: ${JSON.stringify(request.params.arguments)}`); throw error; } break;
- binaryninja-mcp-bridge.js:89-92 (registration)Tool registration entry in ListTools response: defines name, description, and inputSchema for list_functions.name: "list_functions", description: "List functions in a binary", inputSchema: zodToJsonSchema(FilePathSchema), },
- binaryninja-mcp-bridge.js:19-21 (schema)Zod schema defining the input parameters for list_functions tool: requires a non-empty 'path' string.const FilePathSchema = z.object({ path: z.string().min(1, "File path cannot be empty") });
- binaryninja_http_server.py:44-52 (handler)Intermediate HTTP server handler for list_functions method: extracts path param, calls BinaryNinjaHTTPClient.list_functions, extracts and returns function names.elif method == "list_functions": path = params.get("path") if not path: return {"error": "Path parameter is required"} functions = client.list_functions(path) func_names = [f["name"] for f in functions] return {"result": func_names}
- binaryninja_http_client.py:109-137 (handler)Core implementation: paginates requests to Binary Ninja HTTP API /functions endpoint (offset/limit) to retrieve all functions from the loaded binary.def list_functions(self, file_path=None): """List all functions in the currently open binary file.""" try: # Get all functions with pagination all_functions = [] offset = 0 limit = 100 while True: response = self._request('GET', 'functions', params={"offset": offset, "limit": limit}) functions = response.get("functions", []) if not functions: break all_functions.extend(functions) # If we got fewer functions than the limit, we've reached the end if len(functions) < limit: break # Move to the next page offset += limit logger.info(f"Retrieved {len(all_functions)} functions in total") return all_functions except Exception as e: logger.error(f"Failed to list functions: {e}") raise