Skip to main content

Agent Decision Guide

webrain exposes 19 intent-based MCP tools. This page is a decision table: given a task, which tool (and which what / action / mode / op selector) should your agent call? The same rules are served to the LLM at runtime by webrain_guide.

The 19 tools at a glance

Decision tree

I need to reach a page → webrain_navigate. Read the returned challenge field — if non-null, the page is gated (see Challenges). It rendered, but nothing is clickable → hydration, not a block. navigate returns at readyState: complete, before an SPA mounts, so re-probe after ~1s and test a real control:
A disabled submit button plus an empty list and a challenge: null response is an unmounted app, not a query result. If a hand-opened tab of the same URL works, the difference is our injected stealth shim — set WEBRAIN_STEALTH_NOISE=0 for the process owning the CDP connection (restart an MCP server to apply) and open a fresh tab: init scripts live for the target’s lifetime, so re-navigating the same tab keeps the old shim and the change looks ignored. Verified cause on ab.gr/storelocator: the NOISE block replaces Object.defineProperty and hooks canvas/audio/canPlayType, which made Next.js abort with Cannot read properties of undefined (reading 'getInitialProps'). I need to see what’s on the page → webrain_observe:
  • what=state / a11y / semantic — DOM structure for reasoning
  • what=html / images — raw content
  • what=screenshot — visual, or what=pixel to inspect coordinates
I need to click / type / scroll → webrain_interact (action=click, type, press, scroll, select, hover, check, upload, wait, dismiss_overlays, …). I need data from the page → webrain_extract:
  • mode=autoschema — no selectors; probes the DOM and proposes a schema
  • mode=schema — extract with your JSON schema
  • mode=regex / table / jsonld / bm25 — targeted modes
Static HTML, no JS? → webrain_scrape (one HTTP GET: no browser process, no render, no JS). One URL → many pages → webrain_crawl (mode=spider, sitemap, scan). seed_from_sitemap starts the frontier from the site’s own sitemap instead of guessing links, and the crawler’s full argument table is below. A fixed list of URLs → webrain_batch (op=fetch | extract | interact | eval | screenshot, optional cdp_urls fan-out). Logged-in / gated content → webrain_session (op=open → login → op=cookies / setcookies, profile save/restore). For protected / Cloudflare / Turnstile sites see Protected Websites and Session Strategy. A PDF, a video, a file → webrain_pdf / webrain_watch / webrain_download. Search the web / structured results → webrain_search (navigate to the results page) or webrain_serp (typed JSON: position/title/url/domain/snippet). Screenshots or visual QA at scale → webrain_vision (op=index / retrieve).

Crawl knobs

The spider’s defaults are safe for a small crawl. These are the arguments that change its behaviour, and the ones worth setting deliberately on a real site. Read the reply’s stats before re-running. challenged, retries and the links_* counters say why pages were skipped, which is usually the answer to “why only N pages?”.

Task → tool quick map