FindNodeTool

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).

text is a case-insensitive substring match against text + content-description; the other selectors are exact matches (see NodeQuery.matches). Matching is read-only and does not act on the tree.

Params: at least one of text, view_id, class_name, package_name (all optional individually, but one is required); limit (optional, clamped 1–200, default 20).

On success returns count (Int) and nodes (List of node projection maps). Returns a validation error when no selector is supplied, and the long-form notConnectedError message when the service is not bound.

Constructors

Link copied to clipboard
constructor(context: Context)

Properties

Link copied to clipboard
open override val annotations: ToolAnnotations
Link copied to clipboard
open override val description: String
Link copied to clipboard
open override val name: String
Link copied to clipboard
open override val parameters: List<ToolParameter>

Functions

Link copied to clipboard
open suspend override fun execute(params: Map<String, Any>): ToolResult