Skip to content

feat: browser automation tool (Playwright)#44

Merged
kienbui1995 merged 1 commit intomainfrom
feat/browser-tool
Apr 12, 2026
Merged

feat: browser automation tool (Playwright)#44
kienbui1995 merged 1 commit intomainfrom
feat/browser-tool

Conversation

@kienbui1995
Copy link
Copy Markdown
Owner

@kienbui1995 kienbui1995 commented Apr 12, 2026

New browser tool for headless web testing:

Actions: navigate, screenshot, click, type, evaluate JS
How: Generates Playwright script → runs via Node.js → returns text + screenshot
Deps: Requires npm i -g playwright && npx playwright install chromium
Graceful: Clear error messages if playwright/node missing

Closes the biggest competitive gap vs Cursor and Cline.

29 tools, 192 tests.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added Browser tool for web automation and headless testing, supporting page navigation, screenshots, element clicking, text input, and JavaScript evaluation.

- New 'browser' tool with 5 actions: navigate, screenshot, click, type, evaluate
- Shells out to Playwright (node) for headless Chromium control
- Returns page text + screenshot path for agent to analyze
- Graceful errors if playwright/node not installed
- 29 tools total, 192 tests pass
@kienbui1995 kienbui1995 merged commit e753c73 into main Apr 12, 2026
3 of 4 checks passed
@kienbui1995 kienbui1995 deleted the feat/browser-tool branch April 12, 2026 18:38
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c778cc2-ff6f-457e-8543-5a328341648d

📥 Commits

Reviewing files that changed from the base of the PR and between 045f7b1 and 31562a3.

📒 Files selected for processing (4)
  • README.md
  • mc/crates/mc-core/src/runtime.rs
  • mc/crates/mc-tools/src/registry.rs
  • mc/crates/mc-tools/src/spec.rs

📝 Walkthrough

Walkthrough

A new "browser" tool was added for headless web/UI testing, enabling actions like navigate, screenshot, click, type, and evaluate on web pages. The feature increments the built-in tools count from 28 to 29 across documentation and tests, with runtime dispatch logic and tool specification definitions.

Changes

Cohort / File(s) Summary
Tool Specification
mc/crates/mc-tools/src/spec.rs
Added new browser ToolSpec entry with JSON schema defining required action field (constrained to navigate, screenshot, click, type, evaluate) and optional fields (url, selector, text, script).
Runtime Execution
mc/crates/mc-core/src/runtime.rs
Implemented new execute_browser async helper that dispatches browser tool requests, reads action-specific JSON parameters, generates inline Playwright (Node) scripts, executes them via node process, and returns results with error handling for missing fields, missing dependencies, and execution failures.
Documentation & Tests
README.md, mc/crates/mc-tools/src/registry.rs
Updated built-in tools count from 28 to 29 in README feature documentation and registry unit test assertion.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client/Dispatcher
    participant Runtime as Runtime Handler
    participant Script as Script Generator
    participant Node as Node Process
    
    Client->>Runtime: dispatch tool (name="browser")
    activate Runtime
    Runtime->>Runtime: validate action & parameters
    Runtime->>Script: construct Playwright script
    activate Script
    Script->>Script: build action-specific JS code
    Script-->>Runtime: return script content
    deactivate Script
    Runtime->>Runtime: write to /tmp/mc_browser_script.js
    Runtime->>Node: execute via node process
    activate Node
    Node->>Node: run Playwright commands
    Node-->>Runtime: return output
    deactivate Node
    Runtime->>Runtime: parse result & error status
    Runtime-->>Client: return (output, error_flag)
    deactivate Runtime
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Poem

🐰 A browser tool hops into the warren today,
With Playwright scripts it web-tests the way,
Twenty-nine tools now stand at the gate,
Navigate, click, and screenshot—it's great!
From rabbit's own paws, the web comes alive! 🌐✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/browser-tool

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant