create_browser_session
must run first. Tools fall into three groups: session (create, close), read (read_page,
collect_data), and act (fill, type_text, click, press_key, scroll,
set_clipboard).
The act tools are backed by POST /v1/session/{id}/act, so anything an agent does here is
reproducible over REST.
Session
create_browser_session
Start a cloud browser and get a link the user can watch. Call this first, everything else needs a live session, and surfacelive_view_url to the user right away.
Returns
live_view_url token expires after about five minutes. The session itself lives longer, so
call create_browser_session again for a fresh link if the old one stops loading.
close_browser_session
Shut the browser down and stop the meter. Call it when the job is finished.Returns
Read
read_page
Navigate the session tourl and return the page as clean markdown. The live view follows along.
Use this for a single page.
Returns
status of no_data means the source was blocked, empty, or behind a login. Report
that honestly; never invent records to fill the gap.
collect_data
Describe a dataset in plain English and get structured records back. It plans the job and runs the whole thing, including pagination.
The call returns
ok, a status (ok, or a terminal no_data when the source was blocked,
empty, or behind a login), and the collected rows as structured JSON. Never invent rows to fill a
no_data result.
Prefer one collect_data call over looping read_page yourself. It is faster, costs less, and it
will not miss paginated results.
Act
The act tools drive the page the session is currently on. They target elements by CSS selector or, forclick, by visible text. If a selector does not match, the tool returns
ok: false with error: "Element not found: ...", so check the result before moving on.
Failure
Text you pass to
fill, type_text, and set_clipboard, such as passwords and tokens, is
never logged or echoed back. The tools return only success or failure.fill
Clear an input and set its value in one call. Best for form fields.Returns
type_text
Type into aselector, or into the currently focused element if no selector is given. Use it for
login and search boxes, and when a field reacts to individual keystrokes rather than a set value.
Returns
click
Click an element by CSSselector, or by visible text.
Pass exactly one of the two.
text is handy when an element has no stable selector.
Returns
press_key
Send a key or combo to the page.Escape is the escape hatch for a modal or popup that has trapped the page.
scroll
Scroll the page vertically.set_clipboard
Put text on the session clipboard so a human can paste it in the live view, for example a password they would rather paste than have the agent type.A worked flow: log in, then read
Create a session, drive the login form, and read a page that is now behind auth. Because the session persists, the laterread_page is authenticated.
set_clipboard with the
value and ask the user to paste it in the live view, or just ask them to type it there directly.
Related
- MCP overview covers connecting a client and the session model.
- Sessions and Fetch are the REST equivalents of the read tools.
- For AI agents lists the invariants to encode.