Package-level declarations

Types

Link copied to clipboard

Process-wide handle to the host app's DroidMcpAccessibilityService instance. Set automatically when the service connects to the system, cleared on disconnect / destroy. Tools call through this rather than relying on Context.getSystemService(AccessibilityService::class.java), which doesn't give back the running service instance.

Link copied to clipboard

Provider object for the accessibility module — the entry point host apps and dispatchers use to register the tools and inspect their special-access state.

Link copied to clipboard
class ClickNodeTool(context: Context) : McpTool

click_node — resolve a node via the shared selector and perform ACTION_CLICK on it. See perform for the result/error shape; on success returns success, action = "click", and the matched view_id.

Link copied to clipboard

Abstract base service that host apps subclass to grant droid-mcp the ability to read the on-screen UI and dispatch clicks / gestures / scrolls.

Link copied to clipboard
class FindAndTapTool(context: Context) : McpTool

find_and_tap — find the first node matching match (per match_kind) and perform ACTION_CLICK on it in one call: a composition of find_node + click_node.

Link copied to clipboard
class FindNodeTool(context: Context) : McpTool

find_node — search the active window's UI tree for nodes matching any combination of text, view_id, class_name, or package_name and return the matches as projections shaped like query_screen entries (see NodeQuery.toMap).

Link copied to clipboard
class GestureTool(context: Context) : McpTool

gesture — dispatch a single-stroke touch gesture via AccessibilityService.dispatchGesture and await the system callback so the call returns only when the gesture completes (or is cancelled).

Link copied to clipboard

get_active_window_info — return the foreground package plus the active window's root-node class (typically the foreground activity's view-root class). Cheap and read-only; safe to poll.

Link copied to clipboard
class GlobalActionTool(context: Context) : McpTool

global_action — dispatch a system-wide AccessibilityService global action: back, home, recents, notifications, quick_settings, power_dialog, lock_screen, or screenshot (see the companion MAP).

Link copied to clipboard

long_click_node — resolve a node via the shared selector and perform ACTION_LONG_CLICK on it. See perform for the result/error shape; on success returns success, action = "long_click", and the matched view_id.

Link copied to clipboard
class LongPressTool(context: Context) : McpTool

long_press — dispatch a long-press gesture (a held stroke via tapPath) at the given screen coordinates and await completion.

Link copied to clipboard
class QueryScreenTool(context: Context) : McpTool

query_screen — dump the active window's AccessibilityNodeInfo tree as a flat, ranked list of node projections.

Link copied to clipboard
class ScrollNodeTool(context: Context) : McpTool

scroll_node — scroll a scrollable node forward or backward via ACTION_SCROLL_FORWARD / ACTION_SCROLL_BACKWARD.

Link copied to clipboard
class ScrollToFindTool(context: Context) : McpTool

scroll_to_find — repeatedly swipe in direction until match appears in the active window's UI tree or max_scrolls is exhausted. The current screen is checked first, so a match already visible on iteration 0 returns without any swipe.

Link copied to clipboard
class SetNodeTextTool(context: Context) : McpTool

set_node_text — replace the text of an editable node via ACTION_SET_TEXT. Works for most native EditText fields; some apps disable accessibility text-set, in which case the IME tools are the fallback.

Link copied to clipboard

take_screenshot_via_a11y — capture the screen via AccessibilityService.takeScreenshot, awaiting the system callback. Unlike the screenshot module's MediaProjection path, this needs no consent prompt, but it requires API 30+ (the tool is filtered out of AccessibilityTools.supportedTools below that).

Link copied to clipboard
class TapTool(context: Context) : McpTool

tap — dispatch a single-tap gesture (a ~50ms stroke via tapPath) at the given screen coordinates and await completion. Use when no node matches the selector or for raw coord-based input.

Link copied to clipboard
class WaitForTextTool(context: Context) : McpTool

wait_for_text — block (with timeout) until a condition holds on screen. Two modes selected by the condition param: