@tontoko/fast-playwright-mcp 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,6 +39,16 @@ A Model Context Protocol (MCP) server that provides browser automation capabilit
39
39
  - Enhanced error handling with alternative element suggestions
40
40
  - Page structure analysis (iframes, modals, accessibility metrics)
41
41
  - Performance monitoring with execution time under 300ms
42
+ - **Enhanced Selector System**. Unified element selection with multiple strategies:
43
+ - **Selector Arrays**: All element-based tools now support multiple selectors with automatic fallback
44
+ - **4 Selector Types**:
45
+ - `ref`: System-generated element IDs from previous tool results (highest priority)
46
+ - `role`: ARIA roles with optional text matching (e.g., `{role: "button", text: "Submit"}`)
47
+ - `css`: Standard CSS selectors (e.g., `{css: "#submit-btn"}`)
48
+ - `text`: Text content search with optional tag filtering (e.g., `{text: "Click me", tag: "button"}`)
49
+ - **Intelligent Resolution**: Parallel CSS resolution, sequential role matching, automatic fallback
50
+ - **Multiple Match Handling**: When multiple elements match, returns candidate list for LLM selection
51
+ - **HTML Inspection**: New `browser_inspect_html` tool for intelligent content extraction with depth control
42
52
 
43
53
  ### Requirements
44
54
  - Node.js 18 or newer
@@ -213,9 +223,6 @@ Playwright MCP server supports following arguments. They can be provided in the
213
223
  --config <path> path to the configuration file.
214
224
  --device <device> device to emulate, for example: "iPhone 15"
215
225
  --executable-path <path> path to the browser executable.
216
- --extension Connect to a running browser instance
217
- (Edge/Chrome only). Requires the "Playwright MCP
218
- Bridge" browser extension to be installed.
219
226
  --headless run browser in headless mode, headed by default
220
227
  --host <host> host to bind server to. Default is localhost. Use
221
228
  0.0.0.0 to bind to all interfaces.
@@ -452,24 +459,23 @@ http.createServer(async (req, res) => {
452
459
 
453
460
  - **browser_batch_execute**
454
461
  - Title: Batch Execute Browser Actions
455
- - Description: Execute multiple browser actions in sequence with optimized response handling.RECOMMENDED:Use this tool instead of individual actions when performing multiple operations to significantly reduce token usage and improve performance.BY DEFAULT use for:form filling(multiple type→click),multi-step navigation,any workflow with 2+ known steps.Saves 90% tokens vs individual calls.globalExpectation:{includeSnapshot:false,snapshotOptions:{selector:"#app"},diffOptions:{enabled:true}}.Per-step override:steps[].expectation.Example:[{tool:"browser_navigate",arguments:{url:"https://example.com"}},{tool:"browser_type",arguments:{element:"username",ref:"#user",text:"john"}},{tool:"browser_click",arguments:{element:"submit",ref:"#btn"}}].
462
+ - Description: Execute multiple browser actions in sequence. PREFER over individual tools for 2+ operations.
456
463
  - Parameters:
457
- - `steps` (array): Array of steps to execute in sequence
464
+ - `steps` (array): Array of steps to execute in sequence. Recommended for form filling (multiple type→click), multi-step navigation, any workflow with 2+ known steps. Saves 90% tokens vs individual calls. Example: [{tool:"browser_navigate",arguments:{url:"https://example.com"}},{tool:"browser_type",arguments:{selectors:[{css:"#user"}],text:"john"}},{tool:"browser_click",arguments:{selectors:[{css:"#btn"}]}}]
458
465
  - `stopOnFirstError` (boolean, optional): Stop entire batch on first error
459
- - `globalExpectation` (optional): Default expectation for all steps
466
+ - `globalExpectation` (optional): Default expectation for all steps. Recommended: {includeSnapshot:false,snapshotOptions:{selector:"#app"},diffOptions:{enabled:true}}. Per-step override with steps[].expectation
460
467
  - Read-only: **false**
461
468
 
462
469
  <!-- NOTE: This has been generated via update-readme.js -->
463
470
 
464
471
  - **browser_click**
465
- - Title: Click
466
- - Description: Perform click on web page.USE batch_execute for multi-click workflows.expectation:{includeSnapshot:false} when next action follows immediately,true to verify result.diffOptions:{enabled:true,format:"minimal"} shows only changes(saves 80% tokens).snapshotOptions:{selector:".result"} to focus on result area.doubleClick:true for double-click,button:"right" for context menu.
472
+ - Title: Perform click on web page
473
+ - Description: Perform click on web page
467
474
  - Parameters:
468
- - `element` (string): Human-readable element description used to obtain permission to interact with the element
469
- - `ref` (string): Exact target element reference from the page snapshot
470
- - `doubleClick` (boolean, optional): Whether to perform a double click instead of a single click
471
- - `button` (string, optional): Button to click, defaults to left
472
- - `expectation` (object, optional): undefined
475
+ - `selectors` (array): Array of element selectors (max 5). Selectors are tried in order until one succeeds (fallback mechanism). Multiple matches trigger an error with candidate list. Supports: ref (highest priority), CSS (#id, .class, tag), role (button, textbox, etc.), text content. Example: [{css: "#submit"}, {role: "button", text: "Submit"}] - tries ID first, falls back to role+text
476
+ - `doubleClick` (boolean, optional): Double-click if true
477
+ - `button` (string, optional): Mouse button (default: left)
478
+ - `expectation` (object, optional): Page state capture config. Use batch_execute for multi-clicks
473
479
  - Read-only: **false**
474
480
 
475
481
  <!-- NOTE: This has been generated via update-readme.js -->
@@ -485,7 +491,8 @@ http.createServer(async (req, res) => {
485
491
  - **browser_console_messages**
486
492
  - Title: Get console messages
487
493
  - Description: Returns all console messages
488
- - Parameters: None
494
+ - Parameters:
495
+ - `consoleOptions` (object, optional): undefined
489
496
  - Read-only: **true**
490
497
 
491
498
  <!-- NOTE: This has been generated via update-readme.js -->
@@ -510,35 +517,32 @@ http.createServer(async (req, res) => {
510
517
 
511
518
  - **browser_drag**
512
519
  - Title: Drag mouse
513
- - Description: Perform drag and drop between two elements.expectation:{includeSnapshot:true,snapshotOptions:{selector:".drop-zone"}} to verify drop result.diffOptions:{enabled:true} shows only what moved.CONSIDER batch_execute if part of larger workflow.
520
+ - Description: Perform drag and drop between two elements
514
521
  - Parameters:
515
- - `startElement` (string): Human-readable source element description used to obtain the permission to interact with the element
516
- - `startRef` (string): Exact source element reference from the page snapshot
517
- - `endElement` (string): Human-readable target element description used to obtain the permission to interact with the element
518
- - `endRef` (string): Exact target element reference from the page snapshot
519
- - `expectation` (object, optional): undefined
522
+ - `startSelectors` (array): Source element selectors for drag start
523
+ - `endSelectors` (array): Target element selectors for drag end
524
+ - `expectation` (object, optional): Page state after drag. Use batch_execute for workflows
520
525
  - Read-only: **false**
521
526
 
522
527
  <!-- NOTE: This has been generated via update-readme.js -->
523
528
 
524
529
  - **browser_evaluate**
525
530
  - Title: Evaluate JavaScript
526
- - Description: Evaluate JavaScript expression on page or element.Returns evaluation result.USE CASES:extract data,modify DOM,trigger events.expectation:{includeSnapshot:false} for data extraction,true if modifying page.element+ref to run on specific element.CONSIDER batch_execute for multiple evaluations.
531
+ - Description: Evaluate JavaScript expression on page or element and return result
527
532
  - Parameters:
528
- - `function` (string): () => { /* code */ } or (element) => { /* code */ } when element is provided
529
- - `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
530
- - `ref` (string, optional): Exact target element reference from the page snapshot
531
- - `expectation` (object, optional): undefined
533
+ - `function` (string): JS function: () => {...} or (element) => {...}
534
+ - `selectors` (array, optional): Optional element selectors. If provided, function receives element as parameter
535
+ - `expectation` (object, optional): Page state config. false for data extraction, true for DOM changes
532
536
  - Read-only: **false**
533
537
 
534
538
  <!-- NOTE: This has been generated via update-readme.js -->
535
539
 
536
540
  - **browser_file_upload**
537
541
  - Title: Upload files
538
- - Description: Upload one or multiple files to file input.paths:["/path/file1.jpg","/path/file2.pdf"] for multiple files.expectation:{includeSnapshot:true,snapshotOptions:{selector:"form"}} to verify upload.Must be triggered after file input interaction.USE batch_execute for click→upload workflows.
542
+ - Description: Upload one or multiple files to file input
539
543
  - Parameters:
540
- - `paths` (array): The absolute paths to the files to upload. Can be a single file or multiple files.
541
- - `expectation` (object, optional): undefined
544
+ - `paths` (array): Absolute paths to upload (array)
545
+ - `expectation` (object, optional): Page state config. Use batch_execute for click→upload
542
546
  - Read-only: **false**
543
547
 
544
548
  <!-- NOTE: This has been generated via update-readme.js -->
@@ -560,74 +564,93 @@ http.createServer(async (req, res) => {
560
564
 
561
565
  - **browser_handle_dialog**
562
566
  - Title: Handle a dialog
563
- - Description: Handle a dialog(alert,confirm,prompt).accept:true to accept,false to dismiss.promptText:"answer" for prompt dialogs.expectation:{includeSnapshot:true} to see page after dialog handling.USE batch_execute if dialog appears during workflow.
567
+ - Description: Handle a dialog (alert, confirm, prompt)
564
568
  - Parameters:
565
- - `accept` (boolean): Whether to accept the dialog.
566
- - `promptText` (string, optional): The text of the prompt in case of a prompt dialog.
567
- - `expectation` (object, optional): undefined
569
+ - `accept` (boolean): Accept (true) or dismiss (false)
570
+ - `promptText` (string, optional): Text for prompt dialogs
571
+ - `expectation` (object, optional): Page state after dialog. Use batch_execute for workflows
568
572
  - Read-only: **false**
569
573
 
570
574
  <!-- NOTE: This has been generated via update-readme.js -->
571
575
 
572
576
  - **browser_hover**
573
577
  - Title: Hover mouse
574
- - Description: Hover over element on page.expectation:{includeSnapshot:true} to capture tooltips/dropdown menus,false for simple hover.snapshotOptions:{selector:".tooltip"} to focus on tooltip area.Often followed by click - use batch_execute for hover→click sequences.
578
+ - Description: Hover over element on page
575
579
  - Parameters:
576
- - `element` (string): Human-readable element description used to obtain permission to interact with the element
577
- - `ref` (string): Exact target element reference from the page snapshot
578
- - `expectation` (object, optional): undefined
580
+ - `selectors` (array): Array of element selectors (max 5). Selectors are tried in order until one succeeds (fallback mechanism). Multiple matches trigger an error with candidate list. Supports: ref (highest priority), CSS (#id, .class, tag), role (button, textbox, etc.), text content. Example: [{css: "#submit"}, {role: "button", text: "Submit"}] - tries ID first, falls back to role+text
581
+ - `expectation` (object, optional): Page state after hover. Use batch_execute for hover→click
582
+ - Read-only: **true**
583
+
584
+ <!-- NOTE: This has been generated via update-readme.js -->
585
+
586
+ - **browser_inspect_html**
587
+ - Title: HTML inspection
588
+ - Description: Extract and analyze HTML content from web pages with intelligent filtering and size control. Optimized for LLM consumption with configurable depth, format options, and automatic truncation.
589
+ - Parameters:
590
+ - `selectors` (array): Array of element selectors to inspect
591
+ - `depth` (number, optional): Maximum hierarchy depth to extract
592
+ - `includeStyles` (boolean, optional): Include computed CSS styles
593
+ - `maxSize` (number, optional): Maximum size in bytes (1KB-500KB)
594
+ - `format` (string, optional): Output format
595
+ - `includeAttributes` (boolean, optional): Include element attributes
596
+ - `preserveWhitespace` (boolean, optional): Preserve whitespace in content
597
+ - `excludeSelector` (string, optional): CSS selector to exclude elements
598
+ - `includeSuggestions` (boolean, optional): Include CSS selector suggestions in output
599
+ - `includeChildren` (boolean, optional): Include child elements in extraction
600
+ - `optimizeForLLM` (boolean, optional): Optimize extracted HTML for LLM consumption
601
+ - `expectation` (object, optional): Page state config (minimal for HTML inspection)
579
602
  - Read-only: **true**
580
603
 
581
604
  <!-- NOTE: This has been generated via update-readme.js -->
582
605
 
583
606
  - **browser_navigate**
584
607
  - Title: Navigate to a URL
585
- - Description: Navigate to a URL.expectation:{includeSnapshot:true} to see what loaded,false if you know what to do next.snapshotOptions:{selector:"#content"} to focus on main content(saves 50% tokens).diffOptions:{enabled:true} when revisiting pages to see only changes.CONSIDER batch_execute for navigate→interact workflows.
608
+ - Description: Navigate to a URL
586
609
  - Parameters:
587
610
  - `url` (string): The URL to navigate to
588
- - `expectation` (object, optional): undefined
611
+ - `expectation` (object, optional): Page state after navigation
589
612
  - Read-only: **false**
590
613
 
591
614
  <!-- NOTE: This has been generated via update-readme.js -->
592
615
 
593
616
  - **browser_navigate_back**
594
- - Title: Go back
595
- - Description: Go back to previous page.expectation:{includeSnapshot:true} to see previous page,false if continuing workflow.diffOptions:{enabled:true} shows only what changed from forward page.USE batch_execute for back→interact sequences.
617
+ - Title: Go back to previous page
618
+ - Description: Go back to previous page
596
619
  - Parameters:
597
- - `expectation` (object, optional): undefined
620
+ - `expectation` (object, optional): Page state after going back
598
621
  - Read-only: **true**
599
622
 
600
623
  <!-- NOTE: This has been generated via update-readme.js -->
601
624
 
602
625
  - **browser_navigate_forward**
603
- - Title: Go forward
604
- - Description: Go forward to next page.expectation:{includeSnapshot:true} to see next page,false if continuing workflow.diffOptions:{enabled:true} shows only what changed from previous page.USE batch_execute for forward→interact sequences.
626
+ - Title: Go forward to next page
627
+ - Description: Go forward to next page
605
628
  - Parameters:
606
- - `expectation` (object, optional): undefined
629
+ - `expectation` (object, optional): Page state after going forward
607
630
  - Read-only: **true**
608
631
 
609
632
  <!-- NOTE: This has been generated via update-readme.js -->
610
633
 
611
634
  - **browser_network_requests**
612
635
  - Title: List network requests
613
- - Description: Returns network requests since loading the page with optional filtering. urlPatterns:["api/users"] to filter by URL patterns. excludeUrlPatterns:["analytics"] to exclude specific patterns. statusRanges:[{min:200,max:299}] for success codes only. methods:["GET","POST"] to filter by HTTP method. maxRequests:10 to limit results. newestFirst:false for chronological order. Supports regex patterns for advanced filtering.
636
+ - Description: Returns network requests since loading the page with optional filtering
614
637
  - Parameters:
615
- - `urlPatterns` (array, optional): URL patterns to include (supports regex)
616
- - `excludeUrlPatterns` (array, optional): URL patterns to exclude (supports regex)
617
- - `statusRanges` (array, optional): Status code ranges to include
618
- - `methods` (array, optional): HTTP methods to filter by
619
- - `maxRequests` (number, optional): Maximum number of results to return (default: 20)
620
- - `newestFirst` (boolean, optional): Sort order - true for newest first (default: true)
638
+ - `urlPatterns` (array, optional): URL patterns to filter (supports regex)
639
+ - `excludeUrlPatterns` (array, optional): URL patterns to exclude (takes precedence)
640
+ - `statusRanges` (array, optional): Status code ranges (e.g., [{min:200,max:299}])
641
+ - `methods` (array, optional): HTTP methods to filter
642
+ - `maxRequests` (number, optional): Max requests to return (default: 20)
643
+ - `newestFirst` (boolean, optional): Order by timestamp (default: newest first)
621
644
  - Read-only: **true**
622
645
 
623
646
  <!-- NOTE: This has been generated via update-readme.js -->
624
647
 
625
648
  - **browser_press_key**
626
649
  - Title: Press a key
627
- - Description: Press a key on the keyboard.Common keys:Enter,Escape,ArrowUp/Down/Left/Right,Tab,Backspace.expectation:{includeSnapshot:false} for navigation keys,true for content changes.CONSIDER batch_execute for multiple key presses.
650
+ - Description: Press a key on the keyboard
628
651
  - Parameters:
629
- - `key` (string): Name of the key to press or a character to generate, such as `ArrowLeft` or `a`
630
- - `expectation` (object, optional): undefined
652
+ - `key` (string): Key to press
653
+ - `expectation` (object, optional): Page state config. Use batch_execute for multiple keys
631
654
  - Read-only: **false**
632
655
 
633
656
  <!-- NOTE: This has been generated via update-readme.js -->
@@ -645,61 +668,58 @@ http.createServer(async (req, res) => {
645
668
 
646
669
  - **browser_select_option**
647
670
  - Title: Select option
648
- - Description: Select option in dropdown.values:["option1","option2"] for multi-select.expectation:{includeSnapshot:false} when part of form filling(use batch),true to verify selection.snapshotOptions:{selector:"form"} for form context.USE batch_execute for form workflows with multiple selects.
671
+ - Description: Select option in dropdown
649
672
  - Parameters:
650
- - `element` (string): Human-readable element description used to obtain permission to interact with the element
651
- - `ref` (string): Exact target element reference from the page snapshot
652
- - `values` (array): Array of values to select in the dropdown. This can be a single value or multiple values.
653
- - `expectation` (object, optional): undefined
673
+ - `selectors` (array): Array of element selectors (max 5). Selectors are tried in order until one succeeds (fallback mechanism). Multiple matches trigger an error with candidate list. Supports: ref (highest priority), CSS (#id, .class, tag), role (button, textbox, etc.), text content. Example: [{css: "#submit"}, {role: "button", text: "Submit"}] - tries ID first, falls back to role+text
674
+ - `values` (array): Values to select (array)
675
+ - `expectation` (object, optional): Page state after selection. Use batch_execute for forms
654
676
  - Read-only: **false**
655
677
 
656
678
  <!-- NOTE: This has been generated via update-readme.js -->
657
679
 
658
680
  - **browser_snapshot**
659
681
  - Title: Page snapshot
660
- - Description: Capture accessibility snapshot of current page.AVOID calling directly - use expectation:{includeSnapshot:true} on other tools instead.USE CASES:Initial page inspection,debugging when other tools didn't capture needed info.snapshotOptions:{selector:"#content"} to focus on specific area.
682
+ - Description: Capture accessibility snapshot of current page
661
683
  - Parameters:
662
- - `expectation` (object, optional): undefined
684
+ - `expectation` (object, optional): Page state config
663
685
  - Read-only: **true**
664
686
 
665
687
  <!-- NOTE: This has been generated via update-readme.js -->
666
688
 
667
689
  - **browser_take_screenshot**
668
690
  - Title: Take a screenshot
669
- - Description: Take a screenshot of current page.Returns image data.expectation:{includeSnapshot:false} to avoid redundant accessibility tree(screenshot≠snapshot).imageOptions:{quality:50,format:"jpeg"} for 70% size reduction.fullPage:true for entire page,element+ref for specific element.USE CASES:visual verification,documentation,error capture.
691
+ - Description: Take a screenshot of current page and return image data
670
692
  - Parameters:
671
693
  - `type` (string, optional): Image format for the screenshot. Default is png.
672
694
  - `filename` (string, optional): File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified.
673
- - `element` (string, optional): Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too.
674
- - `ref` (string, optional): Exact target element reference from the page snapshot. If not provided, the screenshot will be taken of viewport. If ref is provided, element must be provided too.
695
+ - `selectors` (array, optional): Optional element selectors for element screenshots. If not provided, viewport screenshot will be taken.
675
696
  - `fullPage` (boolean, optional): When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Cannot be used with element screenshots.
676
- - `expectation` (object, optional): undefined
697
+ - `expectation` (object, optional): Additional page state config
677
698
  - Read-only: **true**
678
699
 
679
700
  <!-- NOTE: This has been generated via update-readme.js -->
680
701
 
681
702
  - **browser_type**
682
703
  - Title: Type text
683
- - Description: Type text into editable element.FOR FORMS:Use batch_execute to fill multiple fields efficiently.slowly:true for auto-complete fields,submit:true to press Enter after.expectation:{includeSnapshot:false} when filling multiple fields(use batch),true for final verification.snapshotOptions:{selector:"form"} to focus on form only.diffOptions:{enabled:true} shows only what changed in form.
704
+ - Description: Type text into editable element
684
705
  - Parameters:
685
- - `element` (string): Human-readable element description used to obtain permission to interact with the element
686
- - `ref` (string): Exact target element reference from the page snapshot
706
+ - `selectors` (array): Array of element selectors (max 5) supporting ref, role, CSS, or text-based selection
687
707
  - `text` (string): Text to type into the element
688
- - `submit` (boolean, optional): Whether to submit entered text (press Enter after)
689
- - `slowly` (boolean, optional): Whether type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.
690
- - `expectation` (object, optional): undefined
708
+ - `submit` (boolean, optional): Press Enter after typing if true
709
+ - `slowly` (boolean, optional): Type slowly for auto-complete if true
710
+ - `expectation` (object, optional): Page state config. Use batch_execute for forms
691
711
  - Read-only: **false**
692
712
 
693
713
  <!-- NOTE: This has been generated via update-readme.js -->
694
714
 
695
715
  - **browser_wait_for**
696
716
  - Title: Wait for
697
- - Description: Wait for text to appear/disappear or time to pass.PREFER text-based wait over time for reliability.For loading states:wait for text:"Loading..." textGone:true.For dynamic content:wait for specific text to appear.expectation:{includeSnapshot:true,snapshotOptions:{selector:"#status"},diffOptions:{enabled:true}} shows only what changed.AVOID:fixed time waits unless necessary.
717
+ - Description: Wait for text to appear or disappear or a specified time to pass
698
718
  - Parameters:
699
- - `time` (number, optional): The time to wait in seconds
700
- - `text` (string, optional): The text to wait for
701
- - `textGone` (string, optional): The text to wait for to disappear
702
- - `expectation` (object, optional): undefined
719
+ - `time` (number, optional): Wait time in seconds
720
+ - `text` (string, optional): undefined
721
+ - `textGone` (string, optional): undefined
722
+ - `expectation` (object, optional): Page state after wait
703
723
  - Read-only: **true**
704
724
 
705
725
  </details>
@@ -710,39 +730,39 @@ http.createServer(async (req, res) => {
710
730
 
711
731
  - **browser_tab_close**
712
732
  - Title: Close a tab
713
- - Description: Close a tab.index:N to close specific tab,omit to close current.expectation:{includeSnapshot:false} usually sufficient,true to verify remaining tabs.USE batch_execute for multi-tab cleanup.
733
+ - Description: Close a tab by index or close current tab
714
734
  - Parameters:
715
- - `index` (number, optional): The index of the tab to close. Closes current tab if not provided.
716
- - `expectation` (object, optional): undefined
735
+ - `index` (number, optional): Tab index to close (omit for current)
736
+ - `expectation` (object, optional): Page state after close
717
737
  - Read-only: **false**
718
738
 
719
739
  <!-- NOTE: This has been generated via update-readme.js -->
720
740
 
721
741
  - **browser_tab_list**
722
742
  - Title: List tabs
723
- - Description: List browser tabs.Always returns tab list with titles and URLs.expectation:{includeSnapshot:false} for just tab info,true to also see current tab content.USE before tab_select to find right tab.
743
+ - Description: List browser tabs with titles and URLs
724
744
  - Parameters:
725
- - `expectation` (object, optional): undefined
745
+ - `expectation` (object, optional): Page state config
726
746
  - Read-only: **true**
727
747
 
728
748
  <!-- NOTE: This has been generated via update-readme.js -->
729
749
 
730
750
  - **browser_tab_new**
731
751
  - Title: Open a new tab
732
- - Description: Open a new tab.url:"https://example.com" to navigate immediately,omit for blank tab.expectation:{includeSnapshot:true} to see new tab,false if opening for later use.CONSIDER batch_execute for new_tab→navigate→interact.
752
+ - Description: Open a new tab
733
753
  - Parameters:
734
- - `url` (string, optional): The URL to navigate to in the new tab. If not provided, the new tab will be blank.
735
- - `expectation` (object, optional): undefined
754
+ - `url` (string, optional): URL for new tab (optional)
755
+ - `expectation` (object, optional): Page state of new tab
736
756
  - Read-only: **true**
737
757
 
738
758
  <!-- NOTE: This has been generated via update-readme.js -->
739
759
 
740
760
  - **browser_tab_select**
741
761
  - Title: Select a tab
742
- - Description: Select a tab by index.expectation:{includeSnapshot:true} to see selected tab content,false if you know what's there.USE batch_execute for tab_select→interact workflows.
762
+ - Description: Select a tab by index
743
763
  - Parameters:
744
764
  - `index` (number): The index of the tab to select
745
- - `expectation` (object, optional): undefined
765
+ - `expectation` (object, optional): Page state after tab switch
746
766
  - Read-only: **true**
747
767
 
748
768
  </details>
@@ -765,26 +785,26 @@ http.createServer(async (req, res) => {
765
785
 
766
786
  - **browser_mouse_click_xy**
767
787
  - Title: Click
768
- - Description: Click at specific coordinates.Requires --caps=vision.x,y:click position.expectation:{includeSnapshot:true} to verify result.PREFER browser_click with element ref over coordinates.USE batch_execute for coordinate-based workflows.
788
+ - Description: Click at specific coordinates
769
789
  - Parameters:
770
790
  - `element` (string): undefined
771
- - `x` (number): X coordinate
772
- - `y` (number): Y coordinate
773
- - `expectation` (object, optional): undefined
791
+ - `x` (number): X coordinate (requires --caps=vision)
792
+ - `y` (number): Y coordinate (requires --caps=vision)
793
+ - `expectation` (object, optional): Page state after click. Prefer element ref over coords
774
794
  - Read-only: **false**
775
795
 
776
796
  <!-- NOTE: This has been generated via update-readme.js -->
777
797
 
778
798
  - **browser_mouse_drag_xy**
779
799
  - Title: Drag mouse
780
- - Description: Drag from one coordinate to another.Requires --caps=vision.startX,startY→endX,endY.expectation:{includeSnapshot:true,snapshotOptions:{selector:".drop-zone"}} to verify.PREFER browser_drag with element refs over coordinates.
800
+ - Description: Drag from one coordinate to another
781
801
  - Parameters:
782
802
  - `element` (string): undefined
783
- - `startX` (number): Start X coordinate
784
- - `startY` (number): Start Y coordinate
785
- - `endX` (number): End X coordinate
786
- - `endY` (number): End Y coordinate
787
- - `expectation` (object, optional): undefined
803
+ - `startX` (number): Start X (requires --caps=vision)
804
+ - `startY` (number): Start Y (requires --caps=vision)
805
+ - `endX` (number): End X
806
+ - `endY` (number): End Y
807
+ - `expectation` (object, optional): Page state after drag. Prefer element refs over coords
788
808
  - Read-only: **false**
789
809
 
790
810
  <!-- NOTE: This has been generated via update-readme.js -->
@@ -119,7 +119,8 @@ class PageAnalyzer extends DiagnosticBase {
119
119
  }
120
120
  async updateFrameMetadata(frame) {
121
121
  try {
122
- const elementCount = await frame.$$eval("*", (elements) => elements.length);
122
+ const elements = await frame.$$("*");
123
+ const elementCount = elements.length;
123
124
  this.frameManager.updateElementCount(frame, elementCount);
124
125
  } catch {}
125
126
  }
@@ -20,22 +20,22 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
20
20
  // src/schemas/expectation.ts
21
21
  import { z } from "zod";
22
22
  var diffOptionsSchema = z.object({
23
- enabled: z.boolean().default(false),
23
+ enabled: z.boolean().default(false).describe("Show only changes (saves ~80% tokens)"),
24
24
  threshold: z.number().min(0).max(1).default(0.1),
25
- format: z.enum(["unified", "split", "minimal"]).default("unified"),
25
+ format: z.enum(["unified", "split", "minimal"]).default("unified").describe('Diff format ("minimal" for smallest output)'),
26
26
  maxDiffLines: z.number().positive().default(50),
27
27
  ignoreWhitespace: z.boolean().default(true),
28
28
  context: z.number().min(0).default(3)
29
29
  }).optional();
30
30
  var expectationSchema = z.object({
31
- includeSnapshot: z.boolean().optional().default(false),
31
+ includeSnapshot: z.boolean().optional().default(false).describe("Include accessibility tree (false for chained actions)"),
32
32
  includeConsole: z.boolean().optional().default(false),
33
33
  includeDownloads: z.boolean().optional().default(false),
34
34
  includeTabs: z.boolean().optional().default(false),
35
35
  includeCode: z.boolean().optional().default(false),
36
36
  snapshotOptions: z.object({
37
- selector: z.string().optional().describe("CSS selector to limit snapshot scope"),
38
- maxLength: z.number().optional().describe("Maximum characters for snapshot"),
37
+ selector: z.string().optional().describe('CSS selector to limit scope (e.g., ".result", "form")'),
38
+ maxLength: z.number().optional().describe("Max snapshot characters"),
39
39
  format: z.enum(["aria", "text", "html"]).optional().default("aria")
40
40
  }).optional(),
41
41
  consoleOptions: z.object({