| name | maafw-cli |
| description | Control Android (ADB) and Win32 devices via maafw-cli. Use when the user asks to interact with a device, emulator, or window: click, OCR, screenshot, swipe, type, key press, scroll, template match, color match.
|
| argument-hint | [action description] |
maafw-cli Device Automation
You have maafw-cli to control Android and Win32 devices.
Workflow
perceive (ocr / reco / screenshot) -> decide approach -> act -> perceive (verify)
Always perceive the screen first, then decide whether to use OCR, reco, or coordinates.
First-time setup
uvx maafw-cli --help
maafw-cli resource download-ocr
Discover & Connect
maafw-cli device adb
maafw-cli device win32 chrome
maafw-cli connect adb 127.0.0.1:16384
maafw-cli connect win32 "Notepad"
If "No active session" -> connect first. Single-device use doesn't need --on.
Perceive
ocr — extract text, get Element refs (e1, e2...), and auto-save a screenshot; preferred when operating on text
reco — template/feature/color matching, also auto-saves a screenshot; see reco.md
screenshot — save screenshot to file only (use when you just need the image, not recognition)
ocr and reco both print the screenshot path at the end of their output (human mode) or include it as "screenshot" in JSON mode. Use this to view the captured screen.
maafw-cli ocr
maafw-cli ocr --roi 0,0,400,300
maafw-cli screenshot
Reco or OCR returns refs like e1, e2, e3 — use them for clicks. Refs reset on every OCR/reco call.
Actions
maafw-cli click e3
maafw-cli click 452,387
maafw-cli swipe 100,800 100,200
maafw-cli swipe e1 e3
maafw-cli type "hello world"
maafw-cli key enter
maafw-cli scroll 0 -360
maafw-cli screenshot
maafw-cli action longpress e1
maafw-cli action longpress 200,300 --duration 2000
maafw-cli action startapp com.example/.Main
maafw-cli action stopapp com.example
maafw-cli action shell "ls /sdcard"
maafw-cli action touch-down 200,300
maafw-cli action touch-move 400,500
maafw-cli action touch-up
maafw-cli action key-down shift
maafw-cli action key-up shift
maafw-cli action mousemove 100 -50
Rules
- Perceive first — use
ocr, reco, or screenshot to see the screen before acting; never guess coordinates
- OCR for text — when operating on text elements, use
ocr to get Element refs, then click e3 (also gives you a screenshot for free)
- Refs are ephemeral — each OCR/reco call resets refs; run it right before acting
- Verify — perceive again after actions to confirm effect
- Show the user what you see — summarize what's on screen when you perceive it
- Win32 input failures → try Seize first — if click/type/key has no effect on a Win32 window, the first thing to try is reconnecting with
--input-method Seize (see references/troubleshooting.md)
More