Skip to main content
Clipboard commands let you read plain-text clipboard contents, write text to the clipboard, and clear it.

Overview

clipboard-get

Read plain-text clipboard contents

clipboard-set

Write text to the clipboard

clipboard-clear

Clear the clipboard

Common Patterns

Read Clipboard

agent-desktop clipboard-get
Returns:
{
  "ok": true,
  "data": {
    "content": "copied text"
  }
}
If clipboard is empty or contains non-text data:
{
  "ok": true,
  "data": {
    "content": ""
  }
}

Write to Clipboard

agent-desktop clipboard-set "copied"
Sets clipboard to "copied". Other apps can now paste it.

Clear Clipboard

agent-desktop clipboard-clear
Empties the clipboard.

Examples

# Read clipboard
agent-desktop clipboard-get

# Write to clipboard
agent-desktop clipboard-set "hello world"

# Clear clipboard
agent-desktop clipboard-clear

Use Cases

Copy from one app, paste to another:
agent-desktop click @e3
agent-desktop press cmd+c
agent-desktop clipboard-get  # verify copy succeeded
agent-desktop focus-window --app TextEdit
agent-desktop press cmd+v
Extract text from UI via clipboard:
agent-desktop click @e5
agent-desktop press cmd+a
agent-desktop press cmd+c
agent-desktop clipboard-get
# parse clipboard content
Set clipboard programmatically, then paste:
agent-desktop clipboard-set "generated text"
agent-desktop focus @e2
agent-desktop press cmd+v
Clear sensitive data after use:
agent-desktop clipboard-set "secret key"
agent-desktop press cmd+v
agent-desktop clipboard-clear

Clipboard Data Types

Currently only plain text is supported. Future versions may support:
  • Images (PNG, JPEG)
  • Rich text (HTML, RTF)
  • Files (file paths)

Error Handling

Common error codes:
  • ACTION_FAILED: OS rejected clipboard operation (rare)
  • PERM_DENIED: App lacks clipboard access (sandboxing)
All commands return structured JSON with error codes and recovery hints.

Build docs developers (and LLMs) love