Typing tools
Type text into a field or window.
Type text into a field or window.
Served by cua-driver mcp; see MCP tools for every tool.
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), 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.
macOS parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
delay_ms | integer | Ms between characters in the CGEvent fallback. Default 30. 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 a read whose snapshot_id is s0000002a is "s0000002a:11" (also in structuredContent.elements[].element_token). Returns an explicit stale error naming the current snapshots once a newer read supersedes it. | |
pid | integer | Target process ID. | |
scope | "window" | "desktop" | "window" | "desktop" with no pid/window_id types into the frontmost app. |
session | string | For multi-call work, prefer a short public session label and repeat it on every call that accepts it. | |
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 |
|---|---|---|---|
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 | Display id. Required when kind is desktop; use "primary". | |
target.kind | "window" | "desktop" | window requires pid and window_id; desktop requires display_id. | |
target.pid | integer | Process id. Required when kind is window. Minimum: 0. | |
target.window_id | integer | Window id from list_windows. Required when kind is window. Minimum: 0. |
Example arguments
{"text":"<text>"}