Skip to main content

File Upload

browser_file_upload

Handle file chooser dialogs. When a page opens a file picker, the tool response reports the modal state and every other tool refuses to run until it is handled:

### Modal state
- [File chooser]: can be handled by browser_file_upload
ParameterTypeRequiredDescription
pathsstring[]noThe absolute paths to the files to upload. Can be a single file or multiple files. If omitted, the file chooser is cancelled
→ browser_click { target: "e8" }

### Modal state
- [File chooser]: can be handled by browser_file_upload

→ browser_file_upload { paths: ["/home/user/documents/report.pdf"] }

- text: report.pdf selected
- button "Upload" [ref=e12]

→ browser_click { target: "e12" }

Multiple files

→ browser_file_upload {
paths: [
"/home/user/photos/image1.jpg",
"/home/user/photos/image2.jpg"
]
}

Cancel the file chooser

→ browser_file_upload

browser_drop

Drop files or MIME-typed data onto an element, as if dragged in from outside the page. Use this for drag-and-drop upload zones that never open a file chooser. At least one of paths or data must be provided.

ParameterTypeRequiredDescription
targetstringyesElement ref from the snapshot, or a unique selector
pathsstring[]noAbsolute paths to files to drop onto the element
dataobjectnoData to drop, as a map of MIME type to string value
→ browser_drop {
target: "e7",
paths: ["/home/user/photos/image1.jpg"]
}

→ browser_drop {
target: "e12",
data: { "text/plain": "hello", "text/uri-list": "https://example.com" }
}

To drag between two elements already on the page, use browser_drag instead.

note

By default, file access is restricted to paths within the MCP workspace roots. Use --allow-unrestricted-file-access to allow files from anywhere.