> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobster.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Files, photos and videos

> Attach a file to a check, and move files between your Mac and your iPhone.

Attach a file for Mobster to read in a task: "Open YourApp and check that its Terms screen matches this PDF", with the PDF attached. Put a file on your iPhone and it lands in an app's folder, the one Files shows under On My iPhone, where that app can open it. Bring a file back from that folder to this Mac.

Files stay on this Mac. A task sends your model provider only what it reads from them, as it sends the screen. Nothing reaches your iPhone without your click, your command or your OK.

A file's text is data: it can't approve an action.

## What Mobster reads

| File | What the agent gets |
| - | - |
| Images: PNG, JPEG, HEIC, GIF, WebP | the picture itself (at most 1,024 pixels, upright, up to 4 pictures a task), and any text in it, read on this Mac. The picture carries none of the photo's details: where it was taken stays on this Mac |
| PDF | each page's text; pages without text (a scan) are read as pictures, up to 20 |
| Text, Markdown, JSON | the text |
| CSV, TSV | the header and the first 200 rows, and how many rows there are |

Mobster checks what a file is from its first bytes, not its name: it refuses a program renamed `policy.pdf`. A file is at most 25 MB, a conversation holds at most 100 MB of files, and Mobster keeps at most 1 GB in all. It refuses a PDF locked with a password, with a sentence that says how to get a copy without one.

Before a task starts, the agent sees each file's name, type and size and as much of its text as fits in 12,000 characters, shared between the files. It reads more with `READ_ATTACHMENT` ("policy.pdf page 3", or the next 6,000 characters of a long text file), as its own step.

## In Mobster for Mac

* **Attach.** Press **+** in the composer, or drop or paste files onto it ("Drop to attach" shows while you drag). Each file shows as a chip with what Mobster read: **PDF, 2 pages, 412 KB**. A file Mobster can't read says why on its chip. Up to 10 files go with a task. A file you add in a conversation stays with that conversation; one you add outside a conversation goes with whichever task you start next.
* **Remove.** The × on a chip. Mobster deletes a file no task used yet from this Mac at once.
* **Open.** Click a chip, or a file in a conversation, to see it under the chips or the message: an image, a PDF's first page or the start of a text file. Click it again, or press `esc`, to put it away.
* **Put on iPhone.** The opened file lists the apps on your iPhone that keep files you can see in Files (Pages, Numbers, Keynote, Documents and others), Photos for a picture, and, for a text file, the clipboard (its whole text, up to 64 KB). Choose one and press **Put on iPhone**. Your click is the go-ahead for that copy. Mobster keeps a file with the same name that is already there, and gives the new one a new name ("policy 2.pdf").
* **Drop on the phone.** Drop a photo on the phone beside the conversation and Mobster adds it to Photos on your iPhone: "Added to Photos on Test iPhone".

## Results into a file

To keep every result of a workflow in one file, connect **Folder** in **Settings › Connectors** and choose it in **Send to**. Mobster adds each result to the end of a CSV or JSON Lines file in a folder in your home folder, and Mobster never replaces what is already there ([A folder on your Mac](https://docs.mobster.dev/webhooks.md#a-folder-on-your-mac)).

## Use files in a task

When a task needs a file on the phone (to attach it in an app, say), the agent uses `PUT_FILE` with the file's name and a destination: an app's bundle ID, `photos` for a picture (any app's photo picker can then attach it), or `clipboard` for a text file. Mobster asks first, with the exact file, app and phone: **Put "policy.pdf" in Pages on Test iPhone?** Only after you approve does it copy, then it checks that the file arrived. The app has to be one you allowed: its first use asks, as in any task. With nobody to ask (Full access, or a script), the copy never runs.

A task an agent outside Mobster started never puts files in an app you turned off for those agents in Settings › Safety.

The run's events say what happened, without the files' text: `attachment_read {id, name, pages?, page?}` when the agent reads a file, and `file_put {name, bytes, destination, status}` after a copy (`status` is `copied` or `failed`).

## `mobster phone file`

Files move between this Mac and the folder of an iPhone app that shares files, over the cable. Nothing else on the phone is reachable: not other apps' data. The camera roll has its own commands, `mobster phone photos add` and `pull` (What it can do).

```sh theme={"theme":"css-variables"}
mobster phone file ls                                        # the apps whose folders show in Files
mobster phone file ls --app com.apple.Pages                  # the files in Pages' folder
mobster phone file put policy.pdf --app com.apple.Pages      # into Files › On My iPhone › Pages
mobster phone file get "Booking policy.pages" --app com.apple.Pages -o ~/Downloads
mobster phone file put fixture.json --app com.example.myapp --container   # a debug build of your own
```

* `put` copies a file of up to 100 MB. A name that's taken gets a new one ("policy 2.pdf") unless you pass `--replace`. `--name` gives it another name on the phone. Mobster copies from a private local snapshot, so a change to the original during approval does not change what is sent.
* `get` saves into the current folder, or the folder or file `-o` names. A file already there is kept, and the copy gets a new name.
* `--container` reaches the Documents folder inside a development build of yours (signed for debugging), for an app that doesn't share files.
* `--device` picks the iPhone (its id, UDID or name from `mobster devices`), and `--json` prints one JSON object.
* Exit codes: 0 done, 1 it failed, 2 usage, 3 no iPhone on a cable, or the iPhone tools are missing.

Mobster for Mac carries the iPhone tools it needs. A copy of Mobster CLI on its own uses Homebrew's: `brew install libimobiledevice`.

**Over Wi-Fi.** Mobster reaches an app's folder only over the cable. A phone on Wi-Fi answers "Files move only over the cable for now. Plug the iPhone into this Mac, then try again." (`needs_cable`). Photos and videos move without a cable: [Photos and videos](#photos-and-videos).

## MCP

`mobster mcp --allow-files` adds three tools for your own agent. Without the flag, the server doesn't list them, and your agent can't call them.

| Tool | What it does |
| - | - |
| `list_files {device, app?}` | without `app`, the apps whose folders show in Files; with it, the files in that app's folder (read-only) |
| `put_file {device, path, app \| clipboard}` | copy a file from this Mac into an app's folder, or a text file's text onto the clipboard (acts on the phone: your agent's own permission prompt applies) |
| `get_file {device, app, name}` | copy a file from an app's folder into the server's working folder, and return its path |

`--allow-device` limits them like every other tool. They never reach the camera roll: `send_media` and `pull_media` ([MCP](https://docs.mobster.dev/mcp-server.md)) do, with `--allow-files` and `--allow-photos`.

## Where files are kept

Beside your task history: in Mobster for Mac, `~/Library/Application Support/app.mobster.desktop/state/attachments/`, one folder per file holding the original, its thumbnail and the text Mobster read. The folders are readable only by you (0700), the files too (0600).

* A file in a conversation stays until you delete the conversation.
* A file a task used, outside a conversation, goes when that task leaves your history.
* Mobster deletes a file nothing used within a day.

## HTTP API

Under `/api/attachments` and `/api/phone/files`, with the same token as the rest of the API ([the HTTP API](https://docs.mobster.dev/scripting.md#the-http-api)). Each error is a sentence with a code.

| Route | Body or query | Answer |
| - | - | - |
| `POST /api/attachments` | the file's bytes as the body (at most 25 MB); `?name=<file name>&thread=<conversation id>` | 201 `{attachment}`, 400 `empty_file`, 413 `too_large`, `thread_full`, `storage_full`, 415 `unsupported_type`, `locked_pdf` |
| `GET /api/attachments/{id}` | | `{attachment}`, 404 `attachment_not_found` |
| `GET /api/attachments/{id}/content` | `?token=` works too, for an `<img>` | the file (text files as `text/plain`) |
| `GET /api/attachments/{id}/thumb` | `?token=` works too | a JPEG of at most 480 pixels, 404 `no_thumbnail` |
| `DELETE /api/attachments/{id}` | | `{deleted: true}` |
| `GET /api/phone/files` | `?device=<id or name>&app=<bundle id>` | `{device, apps: [{bundleId, name}], files?: [{name, bytes, modifiedAt, folder}]}` |
| `POST /api/phone/files/put` | `{device?, attachmentId, destination: "app:<bundle id>" \| "clipboard" \| "photos"}`; use an `Idempotency-Key` for the copy, as below | `{status: "copied", name, path, destination, device}`, 403 `app_only` (from anything but Mobster for Mac, when it runs the server), 409 `device_busy` (while a task, another copy or another process owns the device) |
| `POST /api/phone/files/get` | `{device?, app, name, threadId?}` | 201 `{attachment}`: the file, now an attachment |

An `Idempotency-Key` reserves the resolved device ID, attachment and destination on disk before copying. A completed copy returns its saved success for 10 minutes; reusing the key with another payload, or with a default device or alias that now resolves to another phone, returns `409 idempotency_conflict`. A copy still in progress or with an unknown outcome returns `409 copy_outcome_unknown`, and Mobster never sends it again, including after a restart. Check the destination on your iPhone before you start another copy. Unresolved copies never expire; a full journal refuses new keyed copies with `503 copy_journal_full`.

Set up the device in Mobster before you copy through this API or Mobster for Mac. Mobster uses the configured runner address to take the same device lease as a task. A device without that address returns `409 no_device` before it reserves or sends a copy. Local validation and a busy device do not consume your copy key. `mobster phone file put` uses the USB file service directly and does not need a runner.

An attachment is `{id, name, mime, bytes, kind: image|pdf|text|csv, label, pages?, rows?, columns?, width?, height?, textAvailable, origin: upload|phone, thumbUrl, contentUrl, createdAt, threadId, runIds}` (times in milliseconds). The phone's routes answer 409 `needs_cable` (on Wi-Fi), `no_file_sharing` (that app has no folder in Files), `no_device` or `locked`, 404 `not_found`, and 503 `tools` (the iPhone tools are missing).

**A task with files.** `POST /api/runs` takes `attachmentIds`: up to 10 attachment ids. The run keeps them, and a task in a conversation adds its files to that conversation.

**Events.** The bus topic `attachments` (`GET /api/events?topics=attachments`) carries `attachment_created {id, threadId}`, `attachment_deleted {id}` and `attachments_used {ids, runId, threadId}`. A file brought back into a conversation (`threadId`) is posted to it as a thread item of kind `file_saved`: `{attachment, app, device}`.

## Photos and videos

Send photos and videos from this Mac to any of your iPhones, and bring the newest ones back. Mobster picks the route that reaches the phone: the cable, Wi-Fi, AirDrop or iPhone Mirroring. iCloud Photos is there when you choose it. The route determines what Mobster can check: a matching SHA-256, a library count or a file size. Some routes only report that the file was sent.

```sh theme={"theme":"css-variables"}
mobster phone photos add clip-1.mov cover.heic                 # into Photos › Albums › Mobster
mobster phone photos add launch.mp4 --profile @luca.eats --via airdrop
mobster phone photos pull -n 5 -o ~/Desktop/from-iphone
```

`add` prints what moved and how it was checked:

```text theme={"theme":"css-variables"}
Moved 2 of 2 to Test iPhone over the cable. 2 checked by SHA-256. Photos and videos on the phone: 1,858 before, 1,860 after.
```

### Routes

| Way | Route (`--via`) | How it moves | How Mobster checks it |
| - | - | - | - |
| Mac to iPhone | `cable` | the helper app on the phone saves each file into Photos, in pieces | SHA-256 on the phone before Photos sees it, and the library's count |
| | `wifi` | the same, to a phone on Wi-Fi | the same |
| | `airdrop` | AirDrop, to the phone by its name | the library's count, then SHA-256 of each new item |
| | `mirroring` | Photos opens on the phone, and the files drop onto the iPhone Mirroring window | the same |
| | `icloud` | into this Mac's Photos library, then iCloud Photos carries them | the same, once they arrive (up to 10 minutes) |
| iPhone to Mac | `cable` | the camera roll's originals | each file's size against the phone's listing; its SHA-256 is kept |
| | `wifi` | the helper app reads each original, in pieces | SHA-256 on the phone against this Mac's |
| | `tunnel` | Apple's own tunnel to the phone, no cable | nothing is compared; each file's SHA-256 is kept |
| | `icloud` | the newest originals in this Mac's Photos library | nothing is compared; each file's SHA-256 is kept |

`auto`, the default, tries the routes in that order and skips `icloud`. A copy to this Mac moves to the next route after any failure, since it changes nothing on the phone. A send to the iPhone moves on only when a route refused before sending anything: the phone isn't on a cable, AirDrop doesn't see it, Mirroring isn't set up for it. Once a route sent a file, Mobster never sends it again another way. If the outcome is unknown (AirDrop stopped answering, the library didn't grow), the transfer ends `unknown` and says "Look in Photos before you send it again."

Each file ends one of these ways:

| State | Meaning |
| - | - |
| `verified` | the same SHA-256 on the Mac and on the phone |
| `counted` | the library grew by as many as were sent, or a file copied to this Mac had the size the phone listed, but no checksum was compared |
| `sent` | the route said it went, and nothing on the phone could be read or compared |
| `unknown` | it may or may not have arrived: look before you send it again |
| `failed` | it didn't go |

### Mac to iPhone

A transfer through the helper app holds the phone's device lock through upload and verification. If another task owns the phone, the transfer stops before sending and does not switch to AirDrop or another route. Importing media into a named simulator holds its device lock while `simctl addmedia` runs. A lost import answer ends as unknown; check Photos before sending again.

Photos and videos go into an album, **Mobster** unless you name another with `--album NAME` (`--album ''` for none). Mobster makes the album if it isn't there. JPEG, HEIC, PNG, GIF, WebP, MOV and MP4 go, up to 4 GB each and 50 at a time. Mobster reads what a file is from its first bytes, not its name.

* **Over the cable or Wi-Fi.** Mobster takes a private local snapshot before preflight and approval, so a change to the original does not change the sent file. The helper app on the phone saves each file with PhotoKit, as any app that adds to Photos does. The file goes in pieces of 8 MB, and the phone checks the whole file's SHA-256 against this Mac's before Photos sees it. A file that changed on the way never reaches Photos. The first time, iOS asks on the phone whether Mobster may use Photos: Limit Access is enough. An older helper app takes one file of up to 100 MB, with no album: on the [Devices page](https://docs.mobster.dev/phones.md), choose your iPhone's **⋯** › **Set up again…**, then **Reinstall the helper**.
* **AirDrop.** Mobster opens AirDrop's panel on this Mac and presses the one device named exactly as your iPhone is (Settings › General › About › Name). If two devices nearby share that name, or yours doesn't show within 30 seconds, it presses Cancel and sends nothing. An iPhone signed in to the same Apple Account as this Mac takes the files at once. Another iPhone asks you to Accept. With the helper app running on that iPhone and the phone unlocked, Mobster taps Accept on that AirDrop alert and nothing else. It needs Accessibility for Mobster (System Settings › Privacy & Security › Accessibility).
* **iPhone Mirroring.** Mobster opens Photos on the phone through Spotlight and drops the files on the Mirroring window. iPhone Mirroring doesn't say which iPhone it shows, so this route runs only for the phone you name in `MOBSTER_MIRRORS` (its name or UDID) in `agent.env`. The phone stays locked while it's mirrored.
* **iCloud Photos.** With iCloud Photos on for this Mac and the iPhone, Mobster imports the files into this Mac's Photos library, and iCloud carries them to the phone. Mobster uses it only when you choose `--via icloud`. Photos opens in the background, and macOS asks once whether Mobster may control it.

### iPhone to Mac

`mobster phone photos pull` copies the newest photos, screenshots and screen recordings, newest first: `-n` takes 1 to 20, `--since` takes `10m`, `2h`, `1d` or an ISO time, and `-o` names the folder. `--jpeg` converts HEIC photos to JPEG over the cable.

* **`cable`** reads the camera roll's files as they are. With iCloud Photos' Optimize iPhone Storage on, only what is on the phone comes back.
* **`wifi`** asks the helper app for the newest items in the library. It reads each original in pieces. An original kept only in iCloud is downloaded by the phone first. Under **Limit Access**, the helper app sees only items Mobster adds and items you select for it. Pull everything else over the cable.
* **`tunnel`** reaches the camera roll through the tunnel macOS keeps to an iPhone paired for development, over the cable or the local network, with no root and no Xcode. Mobster runs pymobiledevice3 for it, as a separate program you install yourself: `pipx install pymobiledevice3`. Mobster doesn't ship it. Each call opens the tunnel again, which takes about 7 seconds. Mobster tries a listing a second time when the tunnel wasn't up yet.
* **`icloud`** exports the newest originals from this Mac's Photos library.

### Several phones

Each transfer names one phone: `--device` (its name, id or UDID) or `--profile` (the phone a profile is on, in Settings › Profiles). Transfers to different phones run at the same time. Two to the same phone run one after the other.

### MCP

`send_media` takes `path`, `paths` (up to 49 more), `album` and `via`. `pull_media` takes `count` (1 to 20), `since`, `jpeg` and `via`. Both need their flags, `--allow-files` and `--allow-photos` ([MCP](https://docs.mobster.dev/mcp-server.md)).

`POST /api/transfers` starts a transfer from Mobster for Mac and `GET /api/transfers/{id}` follows it, file by file (Content queue).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.