> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/ericclemmons/agent-native/llms.txt
> Use this file to discover all available pages before exploring further.

# Command reference

> Complete reference of all agent-native CLI commands

Complete reference for all commands in the agent-native CLI toolkit.

## Discovery commands

### apps

List all running GUI applications.

```bash theme={null}
agent-native apps [--format text|json]
```

<ParamField path="--format" type="text|json" default="text">
  Output format
</ParamField>

**Example:**

```bash theme={null}
agent-native apps
```

***

### find

Find accessibility elements matching filters.

```bash theme={null}
agent-native find <app> [OPTIONS]
```

<ParamField path="app" type="string" required>
  Application name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role (e.g., AXButton, AXTextField)
</ParamField>

<ParamField path="--title" type="string">
  Filter by title (substring match)
</ParamField>

<ParamField path="--label" type="string">
  Filter by label (substring match)
</ParamField>

<ParamField path="--identifier" type="string">
  Filter by identifier (substring match)
</ParamField>

<ParamField path="--value" type="string">
  Filter by value (substring match)
</ParamField>

<ParamField path="--depth" type="int" default="10">
  Maximum search depth
</ParamField>

<ParamField path="--max" type="int" default="20">
  Maximum results to return
</ParamField>

<ParamField path="--format" type="text|json" default="text">
  Output format
</ParamField>

**Example:**

```bash theme={null}
agent-native find Safari --role AXButton --title "New Tab"
```

***

### tree

Print the accessibility tree for an application.

```bash theme={null}
agent-native tree <app> [OPTIONS]
```

<ParamField path="app" type="string" required>
  Application name
</ParamField>

<ParamField path="--depth" type="int" default="5">
  Maximum tree depth
</ParamField>

<ParamField path="--format" type="text|json" default="text">
  Output format
</ParamField>

**Example:**

```bash theme={null}
agent-native tree Calculator --depth 3
```

***

### snapshot

Create an accessibility tree snapshot with interactive references (@n1, @n2, etc.).

```bash theme={null}
agent-native snapshot <app> [OPTIONS]
```

<ParamField path="app" type="string" required>
  Application name
</ParamField>

<ParamField path="--interactive" type="flag">
  Show only interactive elements (buttons, text fields, etc.)
</ParamField>

<ParamField path="--compact" type="flag">
  Remove empty structural elements
</ParamField>

<ParamField path="--depth" type="int" default="8">
  Maximum tree depth
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native snapshot Calculator --interactive
```

<Note>
  The snapshot command generates `@n1`, `@n2`, etc. references that can be used with other commands like `click`, `fill`, and `get`.
</Note>

***

### inspect

Inspect all attributes and actions of an element.

```bash theme={null}
agent-native inspect <target> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--identifier" type="string">
  Filter by identifier
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native inspect @n5
agent-native inspect Calculator --role AXButton --title "5"
```

## Application commands

### open

Open or launch an application.

```bash theme={null}
agent-native open <app> [OPTIONS]
```

<ParamField path="app" type="string" required>
  Application name or bundle identifier
</ParamField>

<ParamField path="--format" type="text|json" default="text">
  Output format
</ParamField>

**Example:**

```bash theme={null}
agent-native open Calculator
agent-native open com.apple.calculator
```

***

### screenshot

Capture a screenshot of an app's frontmost window.

```bash theme={null}
agent-native screenshot <app> [path] [OPTIONS]
```

<ParamField path="app" type="string" required>
  Application name or bundle identifier
</ParamField>

<ParamField path="path" type="string">
  Output path (defaults to auto-generated temp file)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native screenshot Safari ~/Desktop/safari.png
```

## Interaction commands

### click

Click an element (performs AXPress action).

```bash theme={null}
agent-native click <target> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--identifier" type="string">
  Filter by identifier
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Examples:**

```bash theme={null}
agent-native click @n5
agent-native click Calculator --role AXButton --title "5"
```

***

### fill

Clear a text field and type new text.

```bash theme={null}
agent-native fill <target> <text> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="text" type="string" required>
  Text to fill
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Examples:**

```bash theme={null}
agent-native fill @n3 "hello world"
agent-native fill TextEdit --role AXTextArea "Document content"
```

***

### type

Type text into an element without clearing existing content.

```bash theme={null}
agent-native type <target> <text> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="text" type="string" required>
  Text to type
</ParamField>

<ParamField path="--role" type="string">
  Filter by role (defaults to TextField)
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--identifier" type="string">
  Filter by identifier
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native type @n7 "additional text"
```

***

### focus

Focus an element.

```bash theme={null}
agent-native focus <target> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--identifier" type="string">
  Filter by identifier
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native focus @n2
```

***

### hover

Hover over an element (moves cursor to center).

```bash theme={null}
agent-native hover <target> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native hover @n8
```

***

### check

Check a checkbox or toggle (idempotent).

```bash theme={null}
agent-native check <target> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role (defaults to CheckBox)
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native check @n12
agent-native check "System Settings" --title "Show scroll bars"
```

***

### uncheck

Uncheck a checkbox or toggle (idempotent).

```bash theme={null}
agent-native uncheck <target> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role (defaults to CheckBox)
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native uncheck @n12
```

***

### select

Select an option from a popup button or combo box.

```bash theme={null}
agent-native select <target> <option> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="option" type="string" required>
  Option to select (by title)
</ParamField>

<ParamField path="--role" type="string">
  Filter by role (defaults to PopUpButton)
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native select @n4 "Medium"
```

***

### action

Perform an arbitrary AX action on an element.

```bash theme={null}
agent-native action <target> <action> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="action" type="string" required>
  Action to perform (e.g., AXPress, AXConfirm, AXIncrement)
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--identifier" type="string">
  Filter by identifier
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native action @n9 AXIncrement
```

<Info>
  Use `inspect` to see available actions for an element.
</Info>

## Keyboard commands

### key

Send keystrokes to an application.

```bash theme={null}
agent-native key <app> <keys...> [OPTIONS]
```

<ParamField path="app" type="string" required>
  Application name or bundle identifier
</ParamField>

<ParamField path="keys" type="string..." required>
  Keys to send (e.g., cmd+k, escape, "Hello world")
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Examples:**

```bash theme={null}
agent-native key Safari cmd+t
agent-native key Terminal "echo hello" return
agent-native key TextEdit cmd+shift+s
```

**Supported modifiers:**

* `cmd` or `command`
* `ctrl` or `control`
* `alt`, `option`, or `opt`
* `shift`

**Special keys:**

* `return`, `enter`, `tab`, `space`
* `delete`, `backspace`, `escape`, `esc`
* `left`, `right`, `up`, `down`
* `home`, `end`, `pageup`, `pagedown`
* `f1` through `f12`

***

### paste

Paste clipboard contents or a file into an app via Cmd+V.

```bash theme={null}
agent-native paste <app> [path] [OPTIONS]
```

<ParamField path="app" type="string" required>
  Application name or bundle identifier
</ParamField>

<ParamField path="path" type="string">
  Path to file to paste (omit to paste clipboard or stdin)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Three input modes:**

1. Paste current clipboard:
   ```bash theme={null}
   agent-native paste Arc
   ```

2. Pipe file to clipboard then paste:
   ```bash theme={null}
   agent-native paste Arc < image.png
   ```

3. Copy file to clipboard then paste:
   ```bash theme={null}
   agent-native paste Arc path/to/image.png
   ```

## Data retrieval commands

### get text

Get the text content of an element.

```bash theme={null}
agent-native get text <target> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native get text @n5
```

***

### get value

Get the value of an input element.

```bash theme={null}
agent-native get value <target> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native get value @n3
```

***

### get attr

Get a specific attribute of an element.

```bash theme={null}
agent-native get attr <target> <attribute> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="attribute" type="string" required>
  Attribute name (e.g., AXRole, AXValue, AXEnabled)
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native get attr @n7 AXEnabled
```

***

### get title

Get the title of the frontmost window of an app.

```bash theme={null}
agent-native get title <app> [OPTIONS]
```

<ParamField path="app" type="string" required>
  Application name
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native get title Safari
```

## State checking commands

### is enabled

Check if an element is enabled.

```bash theme={null}
agent-native is enabled <target> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native is enabled @n4
```

***

### is focused

Check if an element is focused.

```bash theme={null}
agent-native is focused <target> [OPTIONS]
```

<ParamField path="target" type="string" required>
  Target element: `@ref` or app name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--index" type="int" default="0">
  Which match (0-indexed)
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Example:**

```bash theme={null}
agent-native is focused @n3
```

## Wait commands

### wait

Wait until an element matching filters appears.

```bash theme={null}
agent-native wait <app> [OPTIONS]
```

<ParamField path="app" type="string" required>
  Application name
</ParamField>

<ParamField path="--role" type="string">
  Filter by role
</ParamField>

<ParamField path="--title" type="string">
  Filter by title
</ParamField>

<ParamField path="--label" type="string">
  Filter by label
</ParamField>

<ParamField path="--identifier" type="string">
  Filter by identifier
</ParamField>

<ParamField path="--timeout" type="float" default="10.0">
  Timeout in seconds
</ParamField>

<ParamField path="--interval" type="float" default="0.5">
  Poll interval in seconds
</ParamField>

<ParamField path="--format" type="text|json" default="text">
  Output format
</ParamField>

**Example:**

```bash theme={null}
agent-native wait Safari --role AXButton --title "Done" --timeout 30
```

## Browser commands

### js

Execute JavaScript in a browser's active tab.

```bash theme={null}
agent-native js <app> <code> [OPTIONS]
```

<ParamField path="app" type="string" required>
  Browser app name (Arc, Google Chrome, Safari)
</ParamField>

<ParamField path="code" type="string" required>
  JavaScript code to execute
</ParamField>

<ParamField path="--json" type="flag">
  JSON output
</ParamField>

**Examples:**

```bash theme={null}
agent-native js Arc "document.title"
agent-native js Safari "document.querySelectorAll('button').length"
agent-native js Chrome "window.location.href"
```

<Note>
  You must enable "Allow JavaScript from Apple Events" in the browser's developer settings.
</Note>

**Supported browsers:**

* Arc
* Google Chrome (use "Chrome" as shorthand)
* Safari
* Chromium
* Brave Browser
* Microsoft Edge (use "Edge" as shorthand)
