selectAllText
Highlight all text in the focused input field on Android or iOS devices with a simple long press and tap on 'Select All' for quick automation.
Instructions
Select all text in the currently focused input field using long press + tap on 'Select All'
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| platform | Yes | Platform of the device |
Implementation Reference
- src/server/interactionTools.ts:272-285 (handler)The handler function for the selectAllText tool. It instantiates SelectAllText class and calls its execute method, then wraps the result.const selectAllTextHandler = async (device: BootedDevice, args: SelectAllTextArgs, progress?: ProgressCallback) => { try { const selectAllText = new SelectAllText(device); const result = await selectAllText.execute(progress); return createJSONToolResponse({ message: "Selected all text in focused input field", observation: result.observation, ...result }); } catch (error) { throw new ActionableError(`Failed to select all text: ${error}`); } };
- src/server/interactionTools.ts:674-680 (registration)Registration of the selectAllText tool in the ToolRegistry with name, description, schema, and handler.ToolRegistry.registerDeviceAware( "selectAllText", "Select all text in the currently focused input field using long press + tap on 'Select All'", selectAllTextSchema, selectAllTextHandler, true // Supports progress notifications );
- Zod schema for input arguments of selectAllText tool (requires platform).export const selectAllTextSchema = z.object({ platform: z.enum(["android", "ios"]).describe("Platform of the device") });
- Core execution logic of SelectAllText: finds focused text input, double-taps center to select all text.async execute(progress?: ProgressCallback): Promise<SelectAllTextResult> { return this.observedInteraction( async (observeResult: ObserveResult) => { try { // Find the focused text input field const targetElement = this.elementUtils.findFocusedTextInput(observeResult.viewHierarchy); // If no focused element, find any text input field if (!targetElement) { throw new ActionableError("No focused text input field found. Please focus on a text field first."); } // Get center coordinates of the text field const tapPoint = this.elementUtils.getElementCenter(targetElement); await this.adb.executeCommand(`shell input tap ${tapPoint.x} ${tapPoint.y}`); await new Promise(resolve => setTimeout(resolve, 100)); await this.adb.executeCommand(`shell input tap ${tapPoint.x} ${tapPoint.y}`); return { success: true }; } catch (error) { return { success: false, error: `Failed to select all text: ${error instanceof Error ? error.message : String(error)}` }; } }, { changeExpected: false, tolerancePercent: 0, timeoutMs: 500, progress } ); }
- Type definition for the output/result of selectAllText operation.export interface SelectAllTextResult { success: boolean; observation?: ObserveResult; error?: string; }