# execute_js

Execute arbitrary JS in the current page context or send JSON CDP bridge commands through the page bridge.

Agent View of the PolicyLayer registry record for `execute_js`. HTML page: https://policylayer.com/tools/335234131-agent-browser-mcp/execute-js

## Facts

- Tool: `execute_js`
- Server: Agent Browser (`335234131/agent-browser-mcp`) — https://policylayer.com/tools/335234131-agent-browser-mcp.md
- Homepage: https://github.com/335234131/agent-browser-mcp
- Risk category: Execute (High risk)
- Registry record: grade F, identity unverified
- Server rate-limited: no
- Parameters: 0
- Recommended policy verdict: Rate-limited

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "execute_js",
    "arguments": {}
  }
}
```

## Why execute_js is rated High

This tool permits execution of arbitrary code (JavaScript) within a live browser context that has access to login sessions, cookies, and sensitive user data as stated in the server description. An AI agent could use this to steal credentials, exfiltrate data, modify page content, perform unauthorized actions on behalf of the logged-in user, or pivot to other systems.

From the tool's own definition: "Tool name 'execute_js' and description 'Execute arbitrary JS in the current page context' explicitly permits running arbitrary JavaScript code."

## Use case

AI agents invoke execute_js to trigger actions in Agent Browser. What it does depends on the arguments the agent supplies, and its effects often reach beyond the immediate call: builds kicked off, notifications sent, workflows started.

## Recommended policy (PolicyLayer)

Verdict: **Rate-limited**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches Agent Browser:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "execute_js": {
      "limits": [
        {
          "counter": "execute_js_rate",
          "window": "minute",
          "max": 10,
          "scope": "grant"
        }
      ]
    }
  }
}
```

## Other tools on Agent Browser (19)

- `cdp_batch` — Execute — https://policylayer.com/tools/335234131-agent-browser-mcp/cdp-batch.md
- `cdp_command` — Execute — https://policylayer.com/tools/335234131-agent-browser-mcp/cdp-command.md
- `hotkey` — Execute — https://policylayer.com/tools/335234131-agent-browser-mcp/hotkey.md
- `mouse_click` — Execute — https://policylayer.com/tools/335234131-agent-browser-mcp/mouse-click.md
- `mouse_drag` — Execute — https://policylayer.com/tools/335234131-agent-browser-mcp/mouse-drag.md
- `mouse_move` — Execute — https://policylayer.com/tools/335234131-agent-browser-mcp/mouse-move.md
- `open_new_tab` — Execute — https://policylayer.com/tools/335234131-agent-browser-mcp/open-new-tab.md
- `open_url` — Execute — https://policylayer.com/tools/335234131-agent-browser-mcp/open-url.md
- `switch_tab` — Execute — https://policylayer.com/tools/335234131-agent-browser-mcp/switch-tab.md
- `type_text` — Execute — https://policylayer.com/tools/335234131-agent-browser-mcp/type-text.md
- `capture_desktop_screenshot` — Read — https://policylayer.com/tools/335234131-agent-browser-mcp/capture-desktop-screenshot.md
- `capture_page_screenshot` — Read — https://policylayer.com/tools/335234131-agent-browser-mcp/capture-page-screenshot.md
- `extension_path` — Read — https://policylayer.com/tools/335234131-agent-browser-mcp/extension-path.md
- `get_cookies` — Read — https://policylayer.com/tools/335234131-agent-browser-mcp/get-cookies.md
- `get_setup_status` — Read — https://policylayer.com/tools/335234131-agent-browser-mcp/get-setup-status.md
- `list_extensions` — Read — https://policylayer.com/tools/335234131-agent-browser-mcp/list-extensions.md
- `list_tabs` — Read — https://policylayer.com/tools/335234131-agent-browser-mcp/list-tabs.md
- `pointer_info` — Read — https://policylayer.com/tools/335234131-agent-browser-mcp/pointer-info.md
- `scan_page` — Read — https://policylayer.com/tools/335234131-agent-browser-mcp/scan-page.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=335234131-agent-browser-mcp · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/335234131-agent-browser-mcp
