upload_image
Uploads an image to a web page by targeting a file input element or simulating a drag-and-drop at a specified viewport coordinate.
Instructions
Feeds a picture the session is already holding - a screenshot or zoom taken with the computer tool, which prints an imageId such as img_3 - into a page, so no file has to travel through you. There are two ways to aim it and you must pick exactly one: ref, an element from read_page or find, which is how you reach a file input the page keeps hidden behind styling; or coordinate, an [x, y] point in the viewport, for editors that take a dropped file and expose no input at all. Giving both is an error and so is giving neither; imageId and tabId are always needed. Down the ref path the image is written to a scratch file in this session's download folder and handed to the input, and should that element turn out not to be a file input, the tool scrolls to it and drops the image on it instead. Down the coordinate path whatever sits under the point gets a synthesized dragenter, dragover and drop, plus a paste event as a fallback when none of the three was taken up. Read the result line: it names which of drop, paste or nothing the page actually handled, so a target that quietly ignored the image cannot pass for success.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | An element id from read_page or find, in the form ref_9. Reach for it whenever the target can be named - above all a file input the page hides - rather than aiming at pixels. Cannot be combined with coordinate, and goes stale as soon as the page navigates or re-renders. | |
| tabId | Yes | The tab that is to receive the image; always required. tabs_context_mcp lists the ids of this session's tabs if you do not have one. | |
| imageId | Yes | The id reported when the picture was captured by the computer tool (its screenshot or zoom action), for instance img_3; an image the user supplied carries one too. Only the 20 most recent survive in the session, so an id from much earlier may already be gone. | |
| filename | No | The name the page should see, image.png when you leave it out. A directory part is stripped off, and a bare name with no suffix gains .png, or .jpg when the capture is a JPEG. | |
| coordinate | No | A point [x, y] in viewport pixels, for a visible region that accepts dropped files without exposing an input. Take the numbers off the newest screenshot; a scroll or a layout shift since then has moved the target out from under them. Cannot be combined with ref. |