All tools

ui_keystroke

Screen, windows & UI · macOS · Windows

Effect: execute (strongest supported action). Status: gated.

Gated means the tool requires an installed app, a connected account, permission, or runtime availability. Check those requirements on the listed platform before using it.

macOS

Purpose

Sends a key combination, e.g. "cmd+shift+5", "return", "cmd+,", "escape". Modifiers: cmd, shift, alt/option, ctrl, fn. The last token is the key. Returns {sent, delivery:"posted_not_confirmed"} — `sent` means the key events were POSTED, NOT that the app acted on them: CGEvent carries no delivery confirmation, and a keystroke's effect is arbitrary so nothing can be read back to prove it. Confirm the effect with ui_get_element / ui_read_tree rather than trusting `sent`. Modifiers are released after the combo, so a following ui_type is not swallowed. unknown_key if the key isn't recognized. Requires Accessibility permission.

Required inputs

Permissions and confirmation

No explicit confirmation parameter is exposed in this snapshot. This does not grant permission to act: obtain user authorization before any real action.

Full input schema — macOS
{
  "properties": {
    "keys": {
      "description": "e.g. cmd+shift+5, return, cmd+,",
      "type": "string"
    }
  },
  "required": [
    "keys"
  ],
  "type": "object"
}

Documentation example

Do not execute this example. These concrete inputs refer to a fictional demonstration dataset. Resolve real handles and obtain user authorization before any real call.

{
  "keys": "escape"
}

Windows

Purpose

Sends a key combination to the focused app, e.g. "ctrl+s", "ctrl+shift+n", "return", "alt+f4", "escape". Modifiers: ctrl, shift, alt, win (cmd is accepted as an alias for ctrl). The last token is the key. unknown_key if the key isn't recognized.

Required inputs

Permissions and confirmation

No explicit confirmation parameter is exposed in this snapshot. This does not grant permission to act: obtain user authorization before any real action.

Full input schema — Windows
{
  "properties": {
    "keys": {
      "description": "e.g. ctrl+s, return, ctrl+shift+n",
      "type": "string"
    }
  },
  "required": [
    "keys"
  ],
  "type": "object"
}

Documentation example

Do not execute this example. These concrete inputs refer to a fictional demonstration dataset. Resolve real handles and obtain user authorization before any real call.

{
  "keys": "escape"
}