zenpilot

v0.10.0
io.github.beSaif/zenpilot Checked 3 days ago Published 2 days ago

Let Claude use your Zen Browser, like Claude in Chrome.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_tabs

List open tabs with ids, marking the user's tab and the one calls without tab_id go to. A tab keeps its id while it's open.

new_tab

Open a new tab, optionally loading url. It becomes active and the default for calls without tab_id. Returns the page's outline, like navigate. outline=false leaves the outline out.

ParameterTypeDescription
outlineboolean
url

switch_tab

Make a tab the active one and the default for calls without tab_id.

ParameterTypeDescription
tab_id *string

close_tab

Close a tab.

ParameterTypeDescription
tab_id *string

navigate

Load url in a tab, or pass 'back', 'forward' or 'reload'. Waits for the page and returns its outline, so you don't need read_page next. 'back' and 'forward' move through the tab's history, which often keeps what the page held, like a half-filled form, where loading its URL again would lose it. outline=false leaves the outline out.

ParameterTypeDescription
url *string
outlineboolean
tab_id

read_page

Outline of the whole page, or of one section by ref: its interactive elements, headings and text. It covers the whole page, not only the part scrolled into view. Interactive elements get refs like r12 for click and type. Sections (main, nav, aside, form, dialog, a named region) get refs too: read_page(ref=...) outlines only that section, get_text(ref=...) reads its text. Checkboxes, radios and switches show checked or unchecked. "clickable" marks an element with a pointer cursor but no role, often a custom toggle; its label is usually the text before it. An open dropdown's options are listed…

ParameterTypeDescription
ref
tab_id

find

List the interactive elements whose read_page line contains query, ignoring case, then the text. Cheaper than read_page on a long page when you need one control, e.g. find("save") or find("email"). Each match says where it is, to tell same-named ones apart: the rest of its list item, table row or card (— in "Blue mug, 12 CHF"), or else the heading before it (— under "Reviews"). Its refs work with click, type and select, and replace earlier refs like read_page's. After the controls come up to 20 lines of text and headings that contain query, each with the heading it's under and the section…

ParameterTypeDescription
query *string
tab_id

read_console

Console messages and uncaught errors the page logged, oldest first, up to limit (max 200). Only what the current page logged while zenpilot was connected: the list empties when the tab navigates, and zenpilot disconnects after 2 minutes without tool calls, so messages from before that are gone. Messages from iframes aren't included. Long messages are cut, and the oldest go first if the output is too long. level shows one level only. clear empties the tab's list after reading it.

ParameterTypeDescription
clearboolean
level
limitinteger
tab_id

read_network_requests

Requests the page made, oldest first, up to limit (max 500): id, method, status, type, time and URL. Only the current page's, from while zenpilot was connected: the list starts over when the tab navigates (keeping the request that loaded the new page), and zenpilot disconnects after 2 minutes without tool calls. Requests from iframes aren't included. url_pattern keeps requests whose URL contains it. clear empties the tab's list after reading it. network_request shows one request's headers and response body.

ParameterTypeDescription
clearboolean
limitinteger
tab_id
url_pattern

network_request

One request from read_network_requests: its headers and response body (cut at 20000 characters). Cookies and authorization headers show as [redacted].

ParameterTypeDescription
request_id *string
tab_id

har_export

Save the requests read_network_requests lists for a tab as a HAR 1.2 file, e.g. to attach to a bug report. It goes in zenpilot's har folder, or at path: an absolute path ending in .har, in zenpilot's state folder or the temp folder. Existing files are never overwritten. Response bodies are left out unless include_bodies, and cut at 100 KB each. Cookie and authorization header values show as [redacted].

ParameterTypeDescription
include_bodiesboolean
path
tab_id

click

Click an element by ref (from read_page) with a real mouse event. double=true double-clicks. button="right" right-clicks, for a page's own menu; Zen's menu stays closed. Reports what changed on the page: + lines appeared (new controls get refs), - lines went away. It also says when a download starts or finishes.

ParameterTypeDescription
ref *string
buttonstring
doubleboolean

drag

Drag an element (by ref) and drop it on another, e.g. to reorder a list or move a card. It drags with the mouse. Where the page uses HTML drag and drop, which Zen doesn't finish for a mouse drag, zenpilot sends the drag events itself; the result says which ran. to_ref can be the drop area or any control inside it, like another card in the target list. Both refs must be on the same page and fit on screen together. The refs say which tab; tab_id, if given, only checks that both are in it. Reports what changed on the page, like click.

ParameterTypeDescription
from_ref *string
to_ref *string
tab_id

type

Replace the content of a field (by ref) with text using real key events. To choose from a dropdown, use select. Date, time, color and range inputs take their value format instead: date YYYY-MM-DD, time HH:MM (24-hour), datetime-local YYYY-MM-DDTHH:MM, month YYYY-MM, week YYYY-Www, color #rrggbb. Newlines in text are typed as Shift+Enter, so they don't send chat messages; submit=true presses Enter after. Reports what changed on the page, like click.

ParameterTypeDescription
ref *string
text *string
submitboolean

select

Choose an option in a dropdown (by ref): a <select>, a combobox or a listbox. Opens it, types to filter if it's a text field, clicks the option whose text is option (or the only one starting with or containing it), then checks the choice took. Reports what changed on the page, like click.

ParameterTypeDescription
option *string
ref *string

fill_form

Fill several fields of a form in one go, e.g. [{"ref": "r3", "value": "Ada"}, {"ref": "r5", "value": "true"}]. Text fields get their content replaced, like type (dates and times take type's formats). A <select>, listbox or dropdown that isn't a text field gets the option whose text is value, like select. Checkboxes, radios and switches take "true" or "false". Fields are filled in order; on a failure it stops and says which were filled. submit_ref, if given, is clicked at the end, e.g. the form's submit button. Reports what changed on the page once, at the end, like click. All refs must be fro…

ParameterTypeDescription
fields *array
submit_ref
tab_id

hover

Move the mouse over an element by ref, to open menus or show tooltips. Reports what changed on the page, like click.

ParameterTypeDescription
ref *string

press_key

Press keys in a tab, e.g. "Enter", "Tab", "Escape" or "ctrl+a". Separate several with spaces. The keys go to the focused element, so click or type first. Reports a navigation, or what changed on the page, like click. Paste shortcuts are refused, to keep the user's clipboard out of the page. Browser shortcuts (back, new tab, the address bar) don't reach Zen: use navigate('back'), navigate('forward'), navigate('reload') or new_tab.

ParameterTypeDescription
keys *string
tab_id

handle_dialog

Answer the alert, confirm or prompt dialog a page opened, which blocks the page until answered. accept=true presses OK, false presses Cancel. text is typed into a prompt before pressing OK. Reports a navigation, or what changed on the page, like click.

ParameterTypeDescription
acceptboolean
tab_id
text

scroll

Scroll the page with the mouse wheel by amount pixels (down if no direction is given). With a ref and no direction, scrolls that element into view. With a ref and a direction, scrolls inside it, e.g. a list or panel with its own scrollbar. With a ref, tab_id is ignored. Reports where it ended up and what changed on the page, like click, so new items of an endless list show up with refs.

ParameterTypeDescription
amountinteger
direction
ref
tab_id

resize_window

Set a tab's viewport to width x height CSS pixels (200 to 4000 each), e.g. to check a phone layout. Only the page inside that tab changes size; Zen's window stays as it is. The size stays through reloads and navigations in the tab, even after zenpilot disconnects, until you call resize_window without width and height. Do that when you're done.

ParameterTypeDescription
height
tab_id
width

screenshot

Screenshot of the visible part of a tab, or of one element by ref (tab_id is then ignored). An image costs far more tokens than read_page, find or get_text, so use it when how the page looks matters (layout, colors, images, charts), not to read text. A ref captures only that element, which costs least. The image is scaled down so its longer side is at most max_size pixels (320 to 4000).

ParameterTypeDescription
max_sizeinteger
ref
tab_id

get_text

Readable text of the page (prefers <main> or a single <article>), or of one element by ref. Shows max_chars characters (100 to 100000) from offset. When there's more, the last line says how to read on, e.g. [more: get_text(offset=8000); ...]. With ref, tab_id is ignored.

ParameterTypeDescription
max_charsinteger
offsetinteger
ref
tab_id

wait_for

Wait until everything given holds: text is on the page, the ref's element is visible, the URL has url_contains. text_gone waits until that text is no longer on the page, e.g. "Loading…". network_idle waits until no request has been in flight for 500 ms; it only works on allowed sites, sees only the tab's own requests (not its iframes'), and never holds on a page that keeps a request open (streaming, long polling). It holds at once if the request hasn't started yet, so pair it with text, text_gone or a ref when you can. Gives up after timeout_ms (100 to 30000). Use it after an action that lo…

ParameterTypeDescription
network_idleboolean
ref
tab_id
text
text_gone
timeout_msinteger
url_contains

report_limitation

Tell the zenpilot developers about something you couldn't do in Zen with these tools. Call it once per problem when a task needs something the tools lack (a widget that ignores clicks, typing, select or drag, content read_page doesn't show) or only works after a workaround. goal: what you were trying to do, in a few words, like "pick a date on a booking form". problem: what you tried and what happened, naming the elements, refs' roles and errors. workaround: what worked instead, if anything. It's saved on the user's computer for them to review and file as a GitHub issue, so leave out personal…

ParameterTypeDescription
goal *string
problem *string
workaroundstring