nokk

v0.1.50a1
io.github.koloss777/nokk Checked 7 hours ago Published 16 days ago

Headless browser for AI agents: passes Cloudflare challenges and reads pages as Markdown.

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

open

Load a page in the browser and wait until it has loaded. Returns the final `url` and `title`. A Cloudflare challenge on the way is solved first (unless the server runs with `--no-auto-solve`); `challenge` then reports `kind`, `solved` and `remaining` (`"none"` once through). Call this before the other tools.

ParameterTypeDescription
url *stringAbsolute address to load, e.g. `https://example.com/`.

solve_challenge

Solve the Cloudflare challenge on the current page: the "Just a moment..." page or a Turnstile widget, pressing its checkbox if it shows one. Only needed when `open` ran with auto-solve off or a widget appeared later. Returns `status`, `solved`, `remaining`, `title` and `url`.

ParameterTypeDescription
timeout_secondsnumberHow long to wait for the challenge to clear, in seconds.

challenge_state

Report whether the current page is behind a bot check. `kind` is `"none"` when the page itself is shown, else the kind of check (`"cloudflare-interstitial"`, `"turnstile-widget"`, `"aws-waf"` and others); `solvable` says whether `solve_challenge` can clear it.

snapshot

Show the current page as a compact outline: headings and text in reading order, and every link, button and form field numbered (`[e12]`) with its name, address or value. Pass a ref to `click` or `fill`. Far smaller than `read_html`; take a new snapshot after the page changes. `null` when `selector` matches nothing.

ParameterTypeDescription
max_charsintegerCut the outline after this many characters.
selectorstringCSS selector of one element; empty for the whole page.

read_page

Read the current page: its main content as Markdown, with headings, lists, tables, code and links, and without navigation, headers, footers, cookie banners or hidden parts. The best tool for reading an article, docs or a listing. A long page comes in parts; the text ends with the `offset` of the next. `null` when `selector` matches nothing.

ParameterTypeDescription
linksstring"inline" ([text](url)), "refs" (numbered, listed at the end) or "none".
max_charsintegerCharacters per part; a longer page comes in parts.
offsetintegerWhere the part starts, as the previous part says (with the same `links`).
selectorstringCSS selector of one element; empty for the whole page.

read_text

Return the visible text of the current page, or of the first element matching `selector`. `null` when no element matches.

ParameterTypeDescription
selectorstringCSS selector of one element; empty for the whole page.

read_html

Return the HTML of the current page as it is now (after its scripts ran), or the outer HTML of the first element matching `selector`. `null` when no element matches.

ParameterTypeDescription
selectorstringCSS selector of one element; empty for the whole page.

click

Click an element: a ref from `snapshot` or the first match of a CSS selector. Returns `true`; fails when nothing matches or the ref is stale.

ParameterTypeDescription
target *stringA ref from the last `snapshot`, e.g. `e12`, or a CSS selector, e.g. `#price`, `form input[name=q]`.

fill

Type `value` into a form field: a ref from `snapshot` or the first match of a CSS selector (its `input` and `change` events fire, as when a person types). Returns `true`; fails when nothing matches or the ref is stale.

ParameterTypeDescription
target *stringA ref from the last `snapshot`, e.g. `e12`, or a CSS selector, e.g. `#price`, `form input[name=q]`.
value *stringText to put in the field.

evaluate

Run a JavaScript expression in the current page and return its value as JSON (a promise is awaited). For data the other tools do not read.

ParameterTypeDescription
expression *stringJavaScript expression, e.g. `document.title` or `[...document.querySelectorAll('h2')].map(e => e.textContent)`.

reset

Close the browser session: cookies and page state are dropped, and the next `open` starts a fresh one.