On this page
Task guides
Automate a page
Use a page snapshot to find controls and verify the result of an interaction, or call tools a site provides through WebMCP.
Start with a snapshot
Use the tabId returned by tab_open or tab_list in the example. An interactive snapshot returns a compact view of the viewport’s controls. Use its element refs to click, type, hover, or select. Read a fresh snapshot after navigation or when refs go stale.
mearl page_snapshot --payload '{"tabId":12345,"mode":"interactive"}'Read what the action changed
Page actions can report changed controls, notifications, navigation, and newly opened tabs. Use these results to decide whether you need another snapshot. Use a screenshot to check visual layout and page inspection to diagnose an overlapping or clipped element.
- For an order search, read a snapshot of the filters, then fill the order number and submit.
- Check the result count or the matching order in the action observation. Take a fresh snapshot of the results if the observation is inconclusive.
- If the site opens a new tab, use its returned tabId. Verify the order number there before reading the details.
Compose a repeatable flow
Use mearl run for JavaScript with conditions, loops, and browser or Skill commands. Applications can call the TypeScript SDK directly. MCP clients can run the shared actions or use browser_run_code for a scripted sequence.
Discover and call WebMCP tools
WebMCP lets a site expose actions such as looking up an order. Mearl discovers tools registered by the main document in the selected Chrome tab. The extension connection and direct CDP both support discovery and calling, subject to the browser’s WebMCP capabilities.
- Check the webmcp array returned by tab_open, page_navigate, or page_snapshot. Discovery runs in the background. If the directory is missing or truncated, request it explicitly with includeWebMcp set to "full".
- Use the returned ref and the tool’s input schema with page_call_tool. The SDK exposes pageCallTool and MCP exposes browser_page_call_tool. Refresh the directory after navigation or if the ref expires.
- WebMCP is experimental in Chrome and must be enabled for the site or browser. If a browser can only list tools, Mearl reports discovery-only. If no callable tool is available, use the snapshot workflow above.
mearl page_snapshot --payload '{"tabId":12345,"includeWebMcp":"full"}'
mearl page_call_tool --payload '{"tabId":12345,"toolRef":"<ref>","arguments":{"orderId":"123"}}'