RootTools

object RootTools

Provider for the Root-backed shell tools. Wires the shared :droid-mcp-shell-core tool set against RootShellBackend.

Tool NAMES are identical to those in io.droidmcp.shizuku.ShizukuTools — register one or the other, not both (the second addTool call would overwrite the first in the registry). Hosts that want "root if available, else Shizuku" should pick the backend at startup and register tools wired to that one backend.

Root activation is a special-access flow: the user installs a superuser manager (Magisk / KernelSU / SuperSU) and grants this app root access on first request. See docs/ROOT.md.

Functions

Link copied to clipboard
fun all(context: Context): List<McpTool>
Link copied to clipboard
Link copied to clipboard

True when libsu reports the host app has been granted root. Non-blocking: returns false if the prompt has never been triggered (call requestAccess to trigger it).

Link copied to clipboard
Link copied to clipboard
fun requestAccess(onResult: (Boolean) -> Unit? = null)

Trigger the su prompt (if it hasn't fired yet) on a background thread. Optional onResult callback is invoked once libsu has the shell ready, with true when the resulting shell is a root shell, false otherwise (user denied, non-root device, or a non-root default builder was configured). The callback runs on libsu's worker thread — dispatch to the UI thread yourself if you need to mutate UI state.

Link copied to clipboard

No Manifest.permission.* runtime grants — root access is checked at su time via the superuser manager, gated by permissionStatus.

Link copied to clipboard

Returns the same name-set as ShellTools.allNames — root mirrors the Shizuku surface exactly.