javascript_tool
Execute JavaScript in page context with async and shadow-DOM support via __pierce helpers. Use for custom DOM queries, data extraction, or accessing JavaScript APIs not available through other tools.
Instructions
Execute JavaScript in page context. Supports await, async IIFE, and shadow-DOM helpers via __pierce.
When to use: Custom DOM queries, data extraction, or triggering JS APIs not reachable via other tools. When NOT to use: Use interact or act for UI interactions, or extract_data for structured schema-based extraction.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | Yes | Tab ID to execute code in | |
| code | No | JS code. Last expression returned | |
| text | No | Deprecated. Use "code" instead | |
| timeout | No | Timeout in ms. Default: 30000 |