Skip to main content
Dismiss a single notification from the Notification Center using the index obtained from list-notifications.

Usage

agent-desktop dismiss-notification <INDEX> [OPTIONS]

Parameters

INDEX
number
required
1-based notification index from list-notifications. Must be >= 1.Note: While list-notifications returns 0-based indices, this command accepts 1-based indices for user convenience.
agent-desktop dismiss-notification 1
--app
string
Filter notifications by app before selecting the index. This scopes the index to notifications from the specified app only.
agent-desktop dismiss-notification 1 --app Slack

Response

dismissed
object
required
Information about the dismissed notification

Examples

Dismiss by Index

# First, list notifications to get indices
agent-desktop list-notifications

# Dismiss the first notification (index 0 becomes 1)
agent-desktop dismiss-notification 1
{
  "version": "1.0",
  "ok": true,
  "command": "dismiss-notification",
  "data": {
    "dismissed": {
      "index": 0,
      "app_name": "Messages",
      "title": "New message from John",
      "body": "Hey, are you available?"
    }
  }
}

Dismiss with App Filter

# Dismiss the first Slack notification
agent-desktop dismiss-notification 1 --app Slack
{
  "version": "1.0",
  "ok": true,
  "command": "dismiss-notification",
  "data": {
    "dismissed": {
      "index": 3,
      "app_name": "Slack",
      "title": "#engineering",
      "body": "New message in channel"
    }
  }
}

Workflow

1

List notifications

Run list-notifications to see all notifications with their indices:
agent-desktop list-notifications
2

Note the index

Identify the notification you want to dismiss. The JSON response shows 0-based indices.
3

Dismiss

Use the index + 1 (convert to 1-based) to dismiss:
agent-desktop dismiss-notification <INDEX+1>

Use Cases

Dismiss notifications selectively while keeping others:
agent-desktop list-notifications
agent-desktop dismiss-notification 2
agent-desktop dismiss-notification 1
Clear all Slack notifications one by one:
agent-desktop list-notifications --app Slack
agent-desktop dismiss-notification 1 --app Slack
agent-desktop dismiss-notification 1 --app Slack  # indices shift down
Dismiss old notifications in a script:
# Dismiss all notifications older than 1 hour
# (requires parsing timestamps if available)
agent-desktop list-notifications | jq -r '.data.notifications[] | select(.timestamp < ...) | .index + 1' | xargs -I {} agent-desktop dismiss-notification {}

Error Handling

Common error codes:
  • ELEMENT_NOT_FOUND: Index out of range or notification already dismissed
  • INVALID_ARGS: Index is 0 or negative
  • PERM_DENIED: macOS accessibility permission not granted
{
  "version": "1.0",
  "ok": false,
  "command": "dismiss-notification",
  "error": {
    "code": "ELEMENT_NOT_FOUND",
    "message": "No notification found at index 5",
    "suggestion": "Run 'list-notifications' to see current indices"
  }
}

Notes

  • The command uses 1-based indexing for user convenience, but the JSON response shows the original 0-based index
  • After dismissing a notification, all subsequent indices shift down by 1
  • If you dismiss multiple notifications, work from highest to lowest index to avoid shifting issues
  • The --app filter is applied before indexing, so index 1 refers to the first notification from that app

Build docs developers (and LLMs) love