android_list_methods
List all methods of a Java class in an Android application to analyze its behavior and identify potential hooks for security testing.
Instructions
List methods of a Java class
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| class_name | Yes | Full class name (e.g., 'javax.crypto.Cipher') |
Implementation Reference
- src/frida_mcp/android.py:16-19 (handler)The actual implementation of android_list_methods. It takes a class_name string, gets the Frida RPC API via get_api(), and calls android_hooking_get_class_methods with a timeout to retrieve the list of methods for the specified Java class.
def android_list_methods(class_name: str) -> list[str]: """List methods of a Java class.""" api = get_api() return with_timeout(lambda: api.android_hooking_get_class_methods(class_name)) - src/frida_mcp/tools.py:175-185 (schema)Tool registration/schema definition for android_list_methods. Defines its name, description ('List methods of a Java class'), and input schema requiring a 'class_name' string parameter (e.g., 'javax.crypto.Cipher').
Tool( name="android_list_methods", description="List methods of a Java class", inputSchema={ "type": "object", "properties": { "class_name": {"type": "string", "description": "Full class name (e.g., 'javax.crypto.Cipher')"}, }, "required": ["class_name"], }, ), - src/frida_mcp/server.py:78-79 (registration)Dispatch registration in the call_tool function. Routes the 'android_list_methods' tool name to the android.android_list_methods() handler, passing the required 'class_name' argument from the request.
elif name == "android_list_methods": return android.android_list_methods(arguments["class_name"]) - src/frida_mcp/session.py:179-187 (helper)The get_api() helper function used by android_list_methods. Retrieves the active Frida session's RPC API or raises an error if not connected.
def get_api(): """Get the current Frida RPC API or raise error.""" fs = registry.get_active() if fs is None: raise RuntimeError("Not connected. Use 'connect' tool first.") if not fs.is_alive(): registry.remove(fs.id) raise RuntimeError("Session disconnected unexpectedly. Use 'connect' to reconnect.") return fs.api - src/frida_mcp/session.py:15-22 (helper)The with_timeout helper function used by android_list_methods. Wraps a function call with a ThreadPoolExecutor timeout to prevent hanging.
def with_timeout(func, timeout=DEFAULT_API_TIMEOUT): """Run a function with a timeout. Raises TimeoutError if exceeded.""" with ThreadPoolExecutor(max_workers=1) as executor: future = executor.submit(func) try: return future.result(timeout=timeout) except FuturesTimeoutError: raise TimeoutError(f"Operation timed out after {timeout}s")