Click and type
Clicks, typing, keys and shortcuts, element values and the clipboard.
| Tool | Description | Platforms |
|---|---|---|
click | Click a target pid. | macOS, Linux, Windows |
double_click | Double-click at (x, y) or on an AX element identified by element_token. | macOS, Linux, Windows |
right_click | Right-click against a target pid. | macOS, Linux, Windows |
type_text | Insert text via AXSetAttribute(kAXSelectedText) into the element given by element_token, or the pid's focused element. | macOS, Linux, Windows |
press_key | Press and release one key. | macOS, Linux, Windows |
hotkey | Press a key combination: e.g. | macOS, Linux, Windows |
set_value | Set an element's value by element_token. | macOS, Linux, Windows |
clipboard_read | List available system clipboard types and optionally return privacy-sensitive plain text. | macOS, Linux, Windows |
clipboard_write | Replace the system clipboard with exactly one value: plain text, an image from an absolute local path, or a file URL from an absolute local path. | macOS, Linux, Windows |
Served by cua-driver mcp; see MCP tools for every tool.
Click tool#
Click by element or pixel.
click#
Effect: destructive. Platforms: macOS, Linux, Windows.
Click a target pid. Prefer element_token (from get_window_state): it identifies one snapshot element, works on backgrounded, minimized or off-Space windows, and moves no cursor or focus. Use x, y only for canvas / video / WebGL / custom-drawn surfaces missing from the AX tree.
- element_token: AX action path. Tokens are scoped to (pid, window_id) and stale once the window is snapshotted again.
- x, y: window-local pixels of the get_window_state screenshot, sent as CGEvent mouse events. Needs a visible window.
modifiertakes cmd/shift/option/ctrl.
button defaults to left; on the AX path "right" maps to AXShowMenu and "middle" falls back to a pixel click at the element center. action: press (default), show_menu, pick, confirm, cancel, open, show_alternate_ui, show_default_ui; an element listing showalternateui reveals its hover-only controls with show_alternate_ui, in the background and without the pointer. from_zoom:true translates zoom-image pixels after a zoom call. Pressing a popup button opens its menu and leaves it open until an item is chosen or it is dismissed; in the background the user's front window keeps key focus meanwhile. A press on a menu button or popup button returns once its menu is in the accessibility tree (waiting up to 1 s), so the next get_window_state lists the items. To choose an option in one call use set_value. In the background a web <select> (Chrome, Electron) is not opened, because its menu would raise the browser window: the click is refused with select_menu_would_raise_window; use set_value. Several known actions: one run_steps (get_guide({topic:"batching"})).
macOS parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
action | string | AX action: press (default), show_menu, pick, confirm, cancel, open, show_alternate_ui, show_default_ui; or an element's published custom_actions name or raw envelope. show_alternate_ui reveals hover-only controls on an element that lists it, without the pointer. | |
button | "left" | "right" | "middle" | Mouse button. Default left. | |
capture_id | string | Optional capture ID from get_window_state or get_desktop_state. With x,y it is consumed atomically; stale or mismatched captures are refused. | |
count | integer | Click count (pixel path only). Default 1. | |
debug_image_out | string | Write a screenshot with a crosshair at (x, y) to this path. Needs window_id; not with from_zoom. | |
delivery_mode | "background" | "foreground" | Default "background" (no fronting). "foreground" briefly fronts the window, acts, then restores the prior app; needs window_id and is required for modified clicks. Escalate in order: AX element_token, background pixel, foreground, checking state between rungs; a click has no read-back except list-row selection. | |
from_zoom | boolean | x and y are in the last zoom image for this pid. | |
modifier | string[] | Modifier keys: cmd, shift, option/alt, ctrl. | |
pid | integer | Target process ID. Optional with element_token (it carries the pid). | |
post_action_wait | "default" | "none" | "none" returns without waiting up to 300 ms for a new window, menu, dialog or foreground change; a change seen later is reported on the next action's result. | |
scope | "window" | "desktop" | Default "window". "desktop": x,y with no pid/window_id are true screen pixels from get_desktop_state. | |
window_id | integer | Target window ID. Omit with element_token. | |
x | number | X in screenshot pixels (get_window_state PNG, or get_desktop_state PNG for a desktop target). | |
y | number | Y in screenshot pixels from the image selected by target. |
Parameters on every platform
| Parameter | Type | Default | Description |
|---|---|---|---|
element_token | string | Element handle <snapshot_id>:<row> from get_window_state: row [11] of snapshot s0000002a is "s0000002a:11". | |
session | string | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. | |
target | object | Exact window (kind "window", with pid and window_id) or desktop (kind "desktop", with display_id). "primary" is the portable desktop target. | |
target.display_id | string | ||
target.kind | "window" | "desktop" | ||
target.pid | integer | Minimum: 0. | |
target.window_id | integer | Minimum: 0. | |
ui_tree_revision | integer | The ui_tree_revision of the get_window_state read this action was planned from. The action is refused with stale_revision, before any input is delivered, when a later read of the same window saw the tree change or the driver has no revision for the window. It covers changes a read has observed: the driver does not watch the window between reads. Minimum: 0. |
Double-click and right-click tools#
Double-click and right-click by element or pixel.
double_click#
Effect: destructive. Platforms: macOS, Linux, Windows.
Double-click at (x, y) or on an AX element identified by element_token.
AX path (element_token provided): performs AXOpen when the element advertises it (Finder items, openable list rows/cells); otherwise resolves the element's on-screen center and falls back to a pixel double-click there.
Pixel path (x, y provided): two down/up pairs ~80 ms apart at the given coordinates.
macOS parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
delivery_mode | "background" | "foreground" | Default "background": no fronting or focus steal. "foreground": briefly front the target, act, then restore the prior app; the last resort when background did not land. | |
post_action_wait | "default" | "none" | "none" returns without waiting up to 300 ms for a new window, menu, dialog or foreground change; a change seen later is reported on the next action's result. | |
window_id | integer | CGWindowID. Omit when element_token is supplied (the token carries it). | |
x | number | Screen X coordinate (pixel path). | |
y | number | Screen Y coordinate (pixel path). |
Parameters on every platform
| Parameter | Type | Default | Description |
|---|---|---|---|
element_token | string | Element handle <snapshot_id>:<row> from get_window_state: row [11] of snapshot s0000002a is "s0000002a:11". | |
pid | integer | Target process ID. Optional with element_token (the token carries the pid). | |
session | string | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. | |
ui_tree_revision | integer | The ui_tree_revision of the get_window_state read this action was planned from. The action is refused with stale_revision, before any input is delivered, when a later read of the same window saw the tree change or the driver has no revision for the window. It covers changes a read has observed: the driver does not watch the window between reads. Minimum: 0. |
right_click#
Effect: destructive. Platforms: macOS, Linux, Windows.
Right-click against a target pid. Two addressing modes:
-
element_token(from the lastget_window_statesnapshot): performsAXShowMenuon the cached element. Pure AX RPC, works on backgrounded / hidden windows, no cursor move or focus steal. Requires a priorget_window_state(pid, window_id)in this turn. -
x,y: synthesizesrightMouseDown/rightMouseUpCGEvent pair posted to the pid. Driver converts image-pixel → screen-point internally.modifierforces the CGEvent path (AX actions don't propagate modifier keys).
Exactly one of element_token or (x AND y) must be provided. pid is required with x, y; an element_token carries its own pid.
macOS parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
delivery_mode | "background" | "foreground" | Default "background": no fronting or focus steal. "foreground": briefly front the target, act, then restore the prior app; the last resort when background did not land. | |
modifier | string[] | Modifier keys held during the right-click: cmd/shift/option/ctrl. Pixel path only. | |
post_action_wait | "default" | "none" | "none" returns without waiting up to 300 ms for a new window, menu, dialog or foreground change; a change seen later is reported on the next action's result. | |
window_id | integer | CGWindowID. Omit when element_token is supplied (the token carries it). | |
x | number | X in window-local screenshot pixels. Must be provided together with y. | |
y | number | Y in window-local screenshot pixels. Must be provided together with x. |
Parameters on every platform
| Parameter | Type | Default | Description |
|---|---|---|---|
element_token | string | Element handle <snapshot_id>:<row> from get_window_state: row [11] of snapshot s0000002a is "s0000002a:11". | |
pid | integer | Target process ID. Optional with element_token (the token carries the pid). | |
session | string | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. | |
ui_tree_revision | integer | The ui_tree_revision of the get_window_state read this action was planned from. The action is refused with stale_revision, before any input is delivered, when a later read of the same window saw the tree change or the driver has no revision for the window. It covers changes a read has observed: the driver does not watch the window between reads. Minimum: 0. |
Typing tools#
Type text into a field or window.
type_text#
Effect: destructive. Platforms: macOS, Linux, Windows.
Insert text via AXSetAttribute(kAXSelectedText) into the element given by element_token, or the pid's focused element. Does not press keys: use press_key / hotkey for Return, Escape, arrows. If AX insertion is unsupported (Chromium/Electron) or unsafe (LibreOffice), it falls back to CGEvent typing when the route fits the transport budget; longer routes are refused with a safe chunk size.
Web content (browser tabs, Slack, VS Code): AXValue is not proof the DOM saw the text, so the result is effect:"unverifiable" and Electron web content refuses background delivery. For a browser tab use the page tool. For an embedded web view pass x, y (no element_token) to pixel-click the field then type in one call; a pixel click will not reliably open a closed control, so AX-press it open first. Confirm from the screenshot, and use delivery_mode:"foreground" only if background still drops the text.
When key events are needed, an element_token target whose keyboard focus cannot be confirmed is refused with target_focus_unconfirmed, effect "refused", and no key sent. Several known actions: one run_steps (get_guide({topic:"batching"})).
macOS parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
delay_ms | integer | Ms between characters in the CGEvent fallback. Default 0: characters go in batched key events, fast. Set a positive value for one paced key per character (debounced search boxes). Range: 0 to 200. | |
delivery_mode | "background" | "foreground" | Default "background": AX insert, then CGEvent keys, no focus steal. "foreground": front the window, type, restore; last resort for surfaces (WhatsApp/Catalyst) where background keys do not land. | |
element_token | string | Element handle <snapshot_id>:<row> from get_window_state: row [11] of snapshot s0000002a is "s0000002a:11". | |
locked_input | boolean | Send the keys even while the screen is locked, when window_id is its app's only on-screen window and neither an element nor x,y is addressed. The lock hides the window from accessibility, so the keys go unverified. Default false: a locked screen refuses. | |
pid | integer | Target process ID. | |
post_action_wait | "default" | "none" | "none" returns without waiting up to 300 ms for a new window, menu, dialog or foreground change; a change seen later is reported on the next action's result. | |
scope | "window" | "desktop" | "window" | "desktop" with no pid/window_id types into the frontmost app. |
text | string | required | Text to insert. |
window_id | integer | Window ID. Omit with element_token. | |
x | number | Screenshot-pixel X of the field (get_window_state PNG, as in click). With y and no element_token, pixel-clicks to focus, then types. | |
y | number | Screenshot-pixel Y (see x). |
Parameters on every platform
| Parameter | Type | Default | Description |
|---|---|---|---|
literal | boolean | Type text exactly as given; by default a trailing run of unbalanced agent-protocol closing tags is dropped. | |
session | string | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. | |
target | object | Preferred per-call target: an exact window (kind="window", pid, window_id) or the primary desktop (kind="desktop", display_id="primary"). | |
target.display_id | string | ||
target.kind | "window" | "desktop" | ||
target.pid | integer | Minimum: 0. | |
target.window_id | integer | Minimum: 0. | |
ui_tree_revision | integer | The ui_tree_revision of the get_window_state read this action was planned from. The action is refused with stale_revision, before any input is delivered, when a later read of the same window saw the tree change or the driver has no revision for the window. It covers changes a read has observed: the driver does not watch the window between reads. Minimum: 0. |
Example arguments
{"text":"<text>"}Key and shortcut tools#
Press keys and keyboard shortcuts.
press_key#
Effect: destructive. Platforms: macOS, Linux, Windows.
Press and release one key. delivery_mode as in click/type_text.
background(default): posts to the pid without raising the window; withelement_tokenit focuses that element first.foreground: fronts the exact window (needswindow_id), sends a real HID key transition (Chromium content, inline editors, menu equivalents), then restores the prior app.
An element target whose focus cannot be confirmed is refused with target_focus_unconfirmed, effect "refused", and no key dispatched.
Confirmed only when a native AX value/selection read-back changes; otherwise effect:"unverifiable" (not a delivery failure). Keys: return, tab, escape, up/down/left/right, space, delete, home, end, pageup, pagedown, f1-f12, any letter or digit. Several known actions: one run_steps (get_guide({topic:"batching"})).
macOS parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
delivery_mode | "background" | "foreground" | Default "background": no fronting or focus steal. "foreground": briefly front the window, act, restore the prior app; last resort when background did not land. | |
key | string | required | Key name. |
locked_input | boolean | Send the keys even while the screen is locked, when window_id is its app's only on-screen window and neither an element nor x,y is addressed. The lock hides the window from accessibility, so the keys go unverified. Default false: a locked screen refuses. | |
modifiers | string[] | cmd, shift, option/alt, ctrl, fn. | |
pid | integer | Target process ID. | |
post_action_wait | "default" | "none" | "none" returns without waiting up to 300 ms for a new window, menu, dialog or foreground change; a change seen later is reported on the next action's result. | |
scope | "window" | "desktop" | "window" | "desktop" with no pid/window_id sends to the frontmost app. |
window_id | integer | Target window; required for foreground. Does not raise by itself. | |
x | number | Screenshot-pixel X: pixel-click to focus, then send the key. With y, no element_token. | |
y | number | Screenshot-pixel Y (see x). |
Parameters on every platform
| Parameter | Type | Default | Description |
|---|---|---|---|
element_token | string | Element handle <snapshot_id>:<row> from get_window_state: row [11] of snapshot s0000002a is "s0000002a:11". | |
session | string | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. | |
target | object | Preferred per-call target: an exact window (kind="window", pid, window_id) or the primary desktop (kind="desktop", display_id="primary"). | |
target.display_id | string | ||
target.kind | "window" | "desktop" | ||
target.pid | integer | Minimum: 0. | |
target.window_id | integer | Minimum: 0. | |
ui_tree_revision | integer | The ui_tree_revision of the get_window_state read this action was planned from. The action is refused with stale_revision, before any input is delivered, when a later read of the same window saw the tree change or the driver has no revision for the window. It covers changes a read has observed: the driver does not watch the window between reads. Minimum: 0. |
Example arguments
{"key":"<key>"}hotkey#
Effect: destructive. Platforms: macOS, Linux, Windows.
Press a key combination: e.g. ["cmd", "c"] for Copy, ["cmd", "shift", "4"] for screenshot selection. Follows the same delivery_mode ladder as click/type_text: it does NOT raise the window by default:
• background (default): post the combo to the target pid WITHOUT fronting or raising it; uses the macOS 14+ auth-message envelope. Chromium/Electron renderers often drop it anyway; an unverifiable result for one carries escalation.recommended: "foreground". With an AX target, focus that exact element first. No top-level focus steal. window_id here only targets the combo; it does not raise. Background key events never reach a native app's menus, so when the combo is a menu item's key equivalent (cmd+s, cmd+w, ...) and the app is not in front, that menu item runs through accessibility instead (a disabled Save is saved through the app's scripting interface using Apple Events and verified on disk; this requires per-app Automation consent and may show macOS’s first-use consent prompt; denied permission refuses the save); a menu item macOS keeps disabled in the background is refused with background_unavailable. With serve --no-automation-prompts, scripting without granted consent refuses with automation_consent_required, without keyboard fallback.
• foreground: briefly front the window (NSMenu path, < 1 ms via SLPSSetFrontProcessWithOptions) so native menu key-equivalents (Cmd+Z, Cmd+W) dispatch, then restore the prior frontmost; the explicit escalation for menu-bar shortcuts on non-Chromium apps that ignore a background combo. With an AX target or x,y, the focused field receives the chord through the foreground HID queue (needed by native Chromium fields such as the omnibox). Requires window_id.
A combo is never driver-verifiable (no read-back) → effect:"unverifiable"; confirm via screenshot. NOTE: a keyboard combo does NOT focus a text field; to type into a backgrounded Electron input, establish real renderer focus with a PIXEL click first, then type_text. If an app only accepts paste, call clipboard_write, then clipboard_read and verify its types (and text when applicable) before selecting or replacing editor content; only then send Cmd+V.
Recognized modifiers: cmd/command, shift, option/alt, ctrl/control, fn. Non-modifier keys use the same vocabulary as press_key. Order: modifiers first, one non-modifier last.
macOS parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
delivery_mode | "background" | "foreground" | Default "background": no fronting or focus steal. "foreground": briefly front the target, act, then restore the prior app; the last resort when background did not land. | |
keys | string[] | required | Modifier(s) and one non-modifier key, e.g. ["cmd", "c"]. Items: 2 to any. |
pid | integer | Target process ID. Required with x, y; optional with element_token (the token carries the pid). | |
post_action_wait | "default" | "none" | "none" returns without waiting up to 300 ms for a new window, menu, dialog or foreground change; a change seen later is reported on the next action's result. | |
scope | "window" | "desktop" | "window" | Use desktop with no pid/window_id to send the chord to the frontmost application. |
window_id | integer | Target window. Required for delivery_mode:"foreground" (the NSMenu activation needs a window). Does NOT itself raise the window: raising is gated on delivery_mode. | |
x | number | Screenshot-pixel X: the element px action form: pixel-click there to focus, then send the combo (so e.g. Cmd+V pastes into that field). Pass with y. Use for Chromium/Electron surfaces the background combo can't reach. | |
y | number | Screenshot-pixel Y (see x). |
Parameters on every platform
| Parameter | Type | Default | Description |
|---|---|---|---|
element_token | string | Element handle <snapshot_id>:<row> from get_window_state: row [11] of snapshot s0000002a is "s0000002a:11". | |
session | string | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. | |
target | object | Preferred per-call target: an exact window (kind="window", pid, window_id) or the primary desktop (kind="desktop", display_id="primary"). | |
target.display_id | string | ||
target.kind | "window" | "desktop" | ||
target.pid | integer | Minimum: 0. | |
target.window_id | integer | Minimum: 0. | |
ui_tree_revision | integer | The ui_tree_revision of the get_window_state read this action was planned from. The action is refused with stale_revision, before any input is delivered, when a later read of the same window saw the tree change or the driver has no revision for the window. It covers changes a read has observed: the driver does not watch the window between reads. Minimum: 0. |
Example arguments
{"keys":["<key>","<key>"]}Value and clipboard tools#
Set element values and read or write the clipboard.
set_value#
Effect: destructive, idempotent. Platforms: macOS, Linux, Windows.
Set an element's value by element_token. A popup button / select dropdown: selects the menu item whose title or value matches value (case-insensitive). Safari <select> is set through the DOM; AppKit and Chromium popups list items only while open, so the menu is opened, the item pressed and the menu closed again (in the background the user's front window keeps key focus). An unknown value lists the options. A native app's own non-secure single-line text fields: select the whole value, type its replacement and end editing. Other elements: write AXValue (sliders, steppers, date pickers, search and secure fields, and any browser or web field, sent no keys). committed distinguishes an ended typed edit with the value in place from not_committed or an AX-only unproven readback. Committed does not mean saved to disk.
A LibreOffice Calc cell ignores AXValue writes, so set_value on a cell goes to it through the Name Box with keys posted to its window (Cmd+Shift+F5, the address, Return), types the value and Return (an empty value clears the cell), and reads the cell back into cell_value; the app stays in the background. On the Name Box itself the value is a cell address to go to. A value with Tab or Return is refused: one cell takes one entry.
A Finder file name cell (list or icon view, not being edited) is renamed through Finder's scripting interface with Finder left in the background, and the new name is read back from disk; the value is the full new name with its extension. macOS may prompt for Automation consent; with serve --no-automation-prompts, ungranted consent refuses with automation_consent_required. Finder's Get Info Name field is refused with file_name_needs_rename. For free-form text in web inputs use type_text_chars: WebKit ignores AXValue writes.
macOS parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
post_action_wait | "default" | "none" | "none" returns without waiting up to 300 ms for a new window, menu, dialog or foreground change; a change seen later is reported on the next action's result. | |
value | string | required | New value, coerced to the element's type. |
window_id | integer | Window ID. Omit with element_token. |
Parameters on every platform
| Parameter | Type | Default | Description |
|---|---|---|---|
element_token | string | Element handle <snapshot_id>:<row> from get_window_state: row [11] of snapshot s0000002a is "s0000002a:11". | |
pid | integer | Target process ID. Optional with element_token (the token carries the pid). | |
session | string | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. | |
ui_tree_revision | integer | The ui_tree_revision of the get_window_state read this action was planned from. The action is refused with stale_revision, before any input is delivered, when a later read of the same window saw the tree change or the driver has no revision for the window. It covers changes a read has observed: the driver does not watch the window between reads. Minimum: 0. |
Example arguments
{"value":"<value>"}clipboard_read#
List available system clipboard types and optionally return privacy-sensitive plain text. Clipboard content is never retained in telemetry.
Effect: read-only. Platforms: macOS, Linux, Windows.
| Parameter | Type | Default | Description |
|---|---|---|---|
include_text | boolean | false | Return plain-text clipboard content in addition to the available types. Clipboard content is privacy-sensitive and is never retained in telemetry. |
session | string | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. |
clipboard_write#
Replace the system clipboard with exactly one value: plain text, an image from an absolute local path, or a file URL from an absolute local path. Returns the available types for read-back before paste.
Effect: destructive, idempotent. Platforms: macOS, Linux, Windows.
| Parameter | Type | Default | Description |
|---|---|---|---|
file_path | string | Absolute path to a local file to place on the clipboard as a file URL. | |
image_path | string | Absolute path to a local image to place on the clipboard. | |
session | string | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. | |
text | string | Plain text to place on the clipboard. |