brave-real-browser-mcp-server 2.14.8 → 2.14.10

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
@@ -557,7 +557,7 @@ Copy and paste this configuration:
557
557
  | Tool | Description |
558
558
  | ----------------------- | ------------------------- |
559
559
  | `progress_tracker` | Track automation progress |
560
- | `error_logger` | Log errors |
560
+
561
561
  | `success_rate_reporter` | Report success rates |
562
562
  | `data_quality_metrics` | Data quality metrics |
563
563
  | `performance_monitor` | Monitor performance |
@@ -0,0 +1,58 @@
1
+ import { getPageInstance } from '../browser-manager.js';
2
+ export async function handleMultiPageScraper(args) {
3
+ const page = getPageInstance();
4
+ if (!page)
5
+ throw new Error('Browser not initialized. Use browser_init first.');
6
+ const results = [];
7
+ const errors = [];
8
+ for (const url of args.urls) {
9
+ try {
10
+ await page.goto(url, { waitUntil: 'domcontentloaded' });
11
+ if (args.waitBetweenPages) {
12
+ await new Promise(resolve => setTimeout(resolve, args.waitBetweenPages));
13
+ }
14
+ const data = await page.evaluate((selector) => {
15
+ const elements = document.querySelectorAll(selector);
16
+ return Array.from(elements).map(el => el.textContent?.trim()).filter(Boolean);
17
+ }, args.dataSelector);
18
+ results.push({ url, data, success: true });
19
+ }
20
+ catch (error) {
21
+ errors.push({ url, error: String(error) });
22
+ results.push({ url, success: false, error: String(error) });
23
+ }
24
+ }
25
+ return {
26
+ content: [{
27
+ type: 'text',
28
+ text: JSON.stringify({ summary: `Scraped ${results.length} pages`, results, errors }, null, 2)
29
+ }]
30
+ };
31
+ }
32
+ export async function handleBreadcrumbNavigator(args) {
33
+ const page = getPageInstance();
34
+ if (!page)
35
+ throw new Error('Browser not initialized. Use browser_init first.');
36
+ const breadcrumbs = await page.evaluate((selector) => {
37
+ const elements = document.querySelectorAll(selector);
38
+ return Array.from(elements).map(el => ({
39
+ text: el.textContent?.trim() || '',
40
+ href: el.href || null
41
+ }));
42
+ }, args.breadcrumbSelector);
43
+ let navigationResult = null;
44
+ if (args.followLinks && breadcrumbs.length > 0) {
45
+ // Navigate to parent (second to last)
46
+ const parent = breadcrumbs.length > 1 ? breadcrumbs[breadcrumbs.length - 2] : null;
47
+ if (parent && parent.href) {
48
+ await page.goto(parent.href);
49
+ navigationResult = `Navigated to parent: ${parent.text} (${parent.href})`;
50
+ }
51
+ }
52
+ return {
53
+ content: [{
54
+ type: 'text',
55
+ text: JSON.stringify({ breadcrumbs, navigationResult }, null, 2)
56
+ }]
57
+ };
58
+ }