Implementation
@override
Tool get definition => Tool(
name: 'tap',
description:
'Tap a node by glintId from get_scene, by its visible text, or x,y (device mode: screenshot pixels; flutter mode: logical points). Returns changed and changeCategory: routeChanged, overlayAppeared, overlayDismissed, contentChanged, nothing, nativeSurface (with a screenshot) or nativeDismissed.',
inputSchema: ObjectSchema(
properties: {
'text': Schema.string(
description:
'Visible text of the target instead of glintId: a button label or text, exact match first, then contains. Dialogs are searched first. Several matches fail with the candidates.',
),
'glintId': Schema.string(
description: 'Stable id from `get_scene`, e.g. floating_action_button',
),
'x': Schema.num(
description: 'Raw x coordinate (with y). Device mode: screenshot pixels; '
'flutter mode: logical points. Off-screen points are refused. Bypasses glintId.',
),
'y': Schema.num(
description: 'Raw y coordinate (with x), same unit.',
),
'sequence': Schema.list(
description: 'Several taps in one call, fired back to back: '
'[{glintId}|{x,y}, …], up to $maxSequenceTaps. For PIN pads, '
'OTP keypads, amounts, repeated backspace. glintIds resolve '
'from one scene read before the first tap; changed is read '
'once at the end.',
items: ObjectSchema(properties: {
'glintId': Schema.string(),
'x': Schema.num(),
'y': Schema.num(),
}),
),
'intervalMs': Schema.int(
description: 'Pause between sequence taps, 0-2000 ms. Default 120.',
),
'refuseNotHittable': Schema.bool(
description:
'true refuses any target that may not be hittable, false never refuses (errorKind=notHittable). Default: refuse only when Flutter\'s hit test shows the tap would land on another widget.',
),
'awaitReady': Schema.bool(
description: 'Wait until the target is on screen and hittable, then act. Default false.',
),
'readyTimeoutMs': Schema.int(
description: 'Ceiling for awaitReady. Default 5000.',
),
'returnScene': Schema.bool(
description: 'Settle, then report changed and changeCategory. Default true.',
),
'detail': Schema.bool(
description: 'Include geometry (painted, hittable, logicalCenter). Default false.',
),
'fetchScene': Schema.bool(
description: 'Also return the new scene text as postScene. Default false.',
),
},
),
);