upload_file
Attach a file to a file input or drop zone in the browser session's active tab, simulating a real user pick with input and change events. Send it by server path or base64 content.
Instructions
Attach a file in the session's active tab, as if picked in the file dialog (which can't be driven): the page gets a real File with input and change events. selector is the file input, or what stands for it on the page: an "Attach" or "Upload" button, its label or the box around it, whose hidden file input is used. An element with no file input behind it is treated as a drop zone and receives the drag and drop a person dropping the file would make. Give the file as a path the server can read, or as content (base64) with its name. Prefer path: content passes the whole file through your context. path is on the machine the server runs on, which may be a container that doesn't see your files; send content then. Up to 25 MB. Returns what received the file and whether the page then shows its name, with where the page is as for click; warns when the input's accept list doesn't take the file.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionId": "<sessionId>",
"selector": "<selector>"
},
"name": "upload_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | The file name the page sees, such as resume.pdf. Defaults to the name in `path`. | |
| path | No | A file on the machine the server runs on, instead of `content`. | |
| content | No | The file's bytes as base64. Needs `name`. | |
| timeout | No | Milliseconds to wait for `selector` to appear. Default 5000. | |
| mimeType | No | The file's type. Default from the name's extension (application/pdf for .pdf). | |
| selector | Yes | The file input, an Attach/Upload button or label for it, or a drop zone. CSS, or plain words as for click. | |
| sessionId | Yes | The id returned by open_browser_session. Errors if no open session has it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hit | No | What was at the clicked or tapped point. | |
| how | Yes | "input" when set on a file input, "drop" when dropped on an element. | |
| url | Yes | The page's URL after the action. | |
| into | Yes | The file input or drop zone that received it. | |
| name | Yes | The file name the page received. | |
| bytes | Yes | ||
| title | Yes | The page's title after the action. | |
| dialog | No | An open dialog's text, if one is showing. | |
| changed | No | A field `type` filled that the page changed once focus left it (a date that reformats or reverts on blur), with both texts. | |
| focused | Yes | The element with keyboard focus, or "nothing". | |
| options | No | The options of a dropdown or list open after the action (the one the focused field controls, else any showing), up to 50: pick one with select_option or click. | |
| answered | No | The page's own dialogs (alert, confirm, prompt, "Leave site?") answered since the last action, each accepted. | |
| mimeType | Yes | ||
| rejected | No | Fields the page rejected during the action, each with its message: the browser's own form check (a required field left empty), or the page marking them invalid. The form wasn't sent while any remain. | |
| navigated | Yes | Whether the URL changed. | |
| focusTrail | No | With press_key's `repeat`: the focused element after each press. | |
| pageShowsName | Yes | Whether the file's name appears on the page after. |