Repository navigation
feat(mcp): iphone_tap_element scrolls to find with scroll - #147
Merged
Merged
Conversation
iphone_tap_element only looks at the current screen, so an item further down a long list needs the agent to swipe, list the elements and try again, one round trip at a time. scroll (down / up) and max_scrolls (default 8, at most 15) make the daemon do it: while the element isn't on screen, or is entirely covered (a row resting under the bottom toolbar), it scrolls 35% of the screen height in the middle of the screen over 1 s and reads the tree again. A 1 s stroke has almost no momentum: on an iPhone 12 mini a 300 pt finger move scrolled 618 pt at 0.3 s and 282 pt at 1 s, and a pause before lifting didn't remove the fling. When the tree no longer changes it is at the end of the list and stops. The answer says how many scrolls it took. Without scroll nothing changes on the wire, and an older daemon ignores the field. Regression case Derrors#151. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 tasks done
Derrors
added a commit
to cosinec/iphone-control
that referenced
this pull request
Nov 17, 2026
Resolve the conflict in docs/dev/regression-cases.md: keep Derrors#146 (from Derrors#139) and this branch's Derrors#147, in order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Derrors
added a commit
that referenced
this pull request
Nov 17, 2026
) Separate taps each wait for the interface to go idle, about 0.5 s apart (iphone_batch: 5 taps in about 2.8 s), so a double tap, or an entry that needs several taps in a short time, couldn't be done: double-tapping the keyboard's Shift only turned it on and off again. iphone_tap takes count (1-10, default 1). Through WDA the taps go in one actions gesture, one finger moving once and tapping the same point MULTI_TAP_GAP_MS (0.1 s) apart; one finger that moves to another point inside a gesture had each tap registered twice. Through HID they go in the same session. count travels in Request::Tap only when it isn't 1, so older daemons see the same requests as before (and ignore it). Regression case #147. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Derrors <33656531+Derrors@users.noreply.github.com>
This was referenced Nov 17, 2026
Resolve the conflicts with Derrors#141, Derrors#143 and Derrors#144: keep both sides (Tap's count and TapSequence next to TapElement's scroll, the protocol helpers, the MCP tests, CHANGELOG lines, doc rows with iphone_tap's count and iphone_tap_element's scroll, regression rows Derrors#146-Derrors#149 then Derrors#151). The search scroll now builds the Stroke that Derrors#144's swipe takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bring in Derrors#145; keep both tests in tools/mod.rs and rows Derrors#150 then Derrors#151. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ining it With scroll, any row that merely contained the text ended the search on the first screen: looking for "App" on the Settings page tapped "Apple账户…" without scrolling. Now the search goes on until the exact label or name is reachable. If none turns up by the end or max_scrolls, the first row seen that contains the text is tapped (scrolling back to it when it has gone off screen), and the result says no exact match was found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 tasks done
Derrors
added a commit
to cosinec/iphone-control
that referenced
this pull request
Nov 17, 2026
Resolve the conflicts with Derrors#141-Derrors#147: keep both sets of client tests, and rows Derrors#146-Derrors#151 from main. This branch's row becomes Derrors#153 (Derrors#152 goes to the native floating search bar fix, Derrors#150). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 of 13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
iphone_tap_elementonly looks at the current screen. To reach an item further down a long list (for example 隐私与安全性 on the Settings page), an agent has to swipe, list the elements, and try again, one model round trip each time. Other phone agents have a "scroll until found" for this.iphone_tap_elementgets two optional parameters:scroll:down(look further down, the finger moves up) orup.max_scrolls: at most this many scrolls, default 8, 1–15 (MAX_SEARCH_SCROLLS).How the daemon searches:
index) isn't entirely covered. I added the second condition after the first device run: the row scrolled into view right under the Settings search toolbar and was reported as covered instead of scrolling once more.swipe(so WDA or HID, and it waits for the list to stop) from 68% to 33% of the screen height in the middle of the screen over 1 s. A normal fast swipe has too much momentum and can fling the target past. Measured on the Settings page with the same 300 pt finger move, the content moved 618 pt at 0.3 s, 420 pt at 0.6 s and 282 pt at 1 s; a W3C pause before lifting didn't remove the fling (467 pt). Each step moves less than half a screen, so consecutive screens overlap and no row is skipped.已到尽头/reached the end).The result line gives the count:
已点击 … (滑了 4 次后找到)/Tapped … (found after 4 scrolls). When nothing is found it reads没找到包含 … 的元素(滑了 6 次,已到尽头). Withoutscroll, a miss now ends with a hint:;可能在屏幕外,可带 scroll 边滑边找/; it may be off screen: pass scroll to look further.Compatibility:
Request::TapElementgetsscroll: Option<ScrollSearch { down, max }>withskip_serializing_if, so a request without it is byte-for-byte unchanged (asserted). An older daemon ignores it and only looks at the current screen.reuse_elementsiniphone_batchkeeps the scroll search.Tests
1. Unit tests
cargo test --workspace --all-features --locked,cargo clippy --workspace --all-targets --all-features --locked -- -D warningsandcargo fmt --check(per package) pass (Rust 1.99.1, macOS)ictl-mcp:tests::tap_element_scroll_search_is_optional_and_checkedcovers: no scroll meansNone;downdefaults to 8;upwithmax_scrolls;left, 0, 16 and a non-string are errors; the scroll survivesreuse_elementsin a batch.ictl-daemon:tools::tests::a_search_scroll_is_a_short_vertical_stroke_in_the_middlechecks the stroke geometry.ictl-protocol:tests::requests_round_trip_as_tagged_jsonchecks the exact JSON without a scroll and round-trips one with it.Request::TapElement { .. }constructions only gainedscroll: None.#[ignore]tests of the changed area run by hand: none apply2. Real-device regression
tests/device/run.pydefault steps pass on this branch (exit code 0): 16 calls, 0 failed, 15.6s in allrun.py output
3. Regression cases (docs/dev/regression-cases.md)
iphone_tap_elementis unchanged (the scroll search only decides when to stop on top of it), and run.py'siphone_tap_elementsteps read as before4. Real-device proof of the fix or feature
down/upare offered)Steps and results
Settings app, opened fresh at the top of its main page. The privacy page opened by the second call was left with the back button before the scroll-up test.
Checklist
scrollgains a short hint at the endDocs:
docs/tools.md,website/guide/tools.md,website/en/guide/tools.md,CHANGELOG.md,CHANGELOG.zh-CN.md.🤖 Generated with Claude Code