brave-real-browser-mcp-server 2.8.2 → 2.8.4
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.
|
@@ -67,18 +67,11 @@ export async function handleSmartSelectorGenerator(args) {
|
|
|
67
67
|
totalCandidates: scores.length
|
|
68
68
|
};
|
|
69
69
|
}, description, context || '');
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
data: result,
|
|
73
|
-
description,
|
|
74
|
-
context
|
|
75
|
-
};
|
|
70
|
+
const resultText = `? Smart Selector Generated\n\nBest Match: ${JSON.stringify(result.bestMatch, null, 2)}\nAlternatives: ${JSON.stringify(result.alternatives, null, 2)}\nTotal Candidates: ${result.totalCandidates}`;
|
|
71
|
+
return { content: [{ type: 'text', text: resultText }] };
|
|
76
72
|
}
|
|
77
73
|
catch (error) {
|
|
78
|
-
return {
|
|
79
|
-
success: false,
|
|
80
|
-
error: error.message
|
|
81
|
-
};
|
|
74
|
+
return { content: [{ type: 'text', text: `? Error: ${error.message}` }], isError: true };
|
|
82
75
|
}
|
|
83
76
|
}
|
|
84
77
|
/**
|
|
@@ -135,10 +128,7 @@ export async function handleContentClassification(args) {
|
|
|
135
128
|
};
|
|
136
129
|
}
|
|
137
130
|
catch (error) {
|
|
138
|
-
return {
|
|
139
|
-
success: false,
|
|
140
|
-
error: error.message
|
|
141
|
-
};
|
|
131
|
+
return { content: [{ type: 'text', text: `? Error: ${error.message}` }], isError: true };
|
|
142
132
|
}
|
|
143
133
|
}
|
|
144
134
|
/**
|
|
@@ -203,10 +193,7 @@ export async function handleSentimentAnalysis(args) {
|
|
|
203
193
|
};
|
|
204
194
|
}
|
|
205
195
|
catch (error) {
|
|
206
|
-
return {
|
|
207
|
-
success: false,
|
|
208
|
-
error: error.message
|
|
209
|
-
};
|
|
196
|
+
return { content: [{ type: 'text', text: `? Error: ${error.message}` }], isError: true };
|
|
210
197
|
}
|
|
211
198
|
}
|
|
212
199
|
/**
|
|
@@ -284,10 +271,7 @@ export async function handleSummaryGenerator(args) {
|
|
|
284
271
|
};
|
|
285
272
|
}
|
|
286
273
|
catch (error) {
|
|
287
|
-
return {
|
|
288
|
-
success: false,
|
|
289
|
-
error: error.message
|
|
290
|
-
};
|
|
274
|
+
return { content: [{ type: 'text', text: `? Error: ${error.message}` }], isError: true };
|
|
291
275
|
}
|
|
292
276
|
}
|
|
293
277
|
/**
|
|
@@ -359,9 +343,6 @@ export async function handleTranslationSupport(args) {
|
|
|
359
343
|
};
|
|
360
344
|
}
|
|
361
345
|
catch (error) {
|
|
362
|
-
return {
|
|
363
|
-
success: false,
|
|
364
|
-
error: error.message
|
|
365
|
-
};
|
|
346
|
+
return { content: [{ type: 'text', text: `? Error: ${error.message}` }], isError: true };
|
|
366
347
|
}
|
|
367
348
|
}
|
|
@@ -62,16 +62,25 @@ export async function handleKeywordSearch(args) {
|
|
|
62
62
|
allMatches: allMatches.slice(0, 100) // Limit to first 100
|
|
63
63
|
};
|
|
64
64
|
}, keywords, caseSensitive, wholeWord, context);
|
|
65
|
+
const resultText = `✅ Keyword Search Results\n\nTotal Matches: ${results.totalMatches}\n\nKeywords searched: ${Array.isArray(keywords) ? keywords.join(', ') : keywords}\n\nMatches by keyword:\n${JSON.stringify(results.matchesByKeyword, null, 2)}\n\nFirst 100 matches:\n${JSON.stringify(results.allMatches, null, 2)}`;
|
|
65
66
|
return {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
content: [
|
|
68
|
+
{
|
|
69
|
+
type: 'text',
|
|
70
|
+
text: resultText,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
69
73
|
};
|
|
70
74
|
}
|
|
71
75
|
catch (error) {
|
|
72
76
|
return {
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: 'text',
|
|
80
|
+
text: `❌ Keyword search failed: ${error.message}`,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
isError: true,
|
|
75
84
|
};
|
|
76
85
|
}
|
|
77
86
|
}
|
|
@@ -119,15 +128,25 @@ export async function handleRegexPatternMatcher(args) {
|
|
|
119
128
|
flags: flgs
|
|
120
129
|
};
|
|
121
130
|
}, pattern, flags, selector || '');
|
|
131
|
+
const resultText = `✅ Regex Pattern Matcher Results\n\nPattern: ${results.pattern}\nFlags: ${results.flags}\nTotal Matches: ${results.totalMatches}\n\nMatches (first 100):\n${JSON.stringify(results.matches, null, 2)}`;
|
|
122
132
|
return {
|
|
123
|
-
|
|
124
|
-
|
|
133
|
+
content: [
|
|
134
|
+
{
|
|
135
|
+
type: 'text',
|
|
136
|
+
text: resultText,
|
|
137
|
+
},
|
|
138
|
+
],
|
|
125
139
|
};
|
|
126
140
|
}
|
|
127
141
|
catch (error) {
|
|
128
142
|
return {
|
|
129
|
-
|
|
130
|
-
|
|
143
|
+
content: [
|
|
144
|
+
{
|
|
145
|
+
type: 'text',
|
|
146
|
+
text: `❌ Regex pattern matcher failed: ${error.message}`,
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
isError: true,
|
|
131
150
|
};
|
|
132
151
|
}
|
|
133
152
|
}
|
|
@@ -184,16 +203,25 @@ export async function handleXPathSupport(args) {
|
|
|
184
203
|
elements
|
|
185
204
|
};
|
|
186
205
|
}, xpath, returnType);
|
|
206
|
+
const resultText = `✅ XPath Query Results\n\nXPath: ${xpath}\nElements Found: ${results.count}\n\nElements:\n${JSON.stringify(results.elements, null, 2)}`;
|
|
187
207
|
return {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
208
|
+
content: [
|
|
209
|
+
{
|
|
210
|
+
type: 'text',
|
|
211
|
+
text: resultText,
|
|
212
|
+
},
|
|
213
|
+
],
|
|
191
214
|
};
|
|
192
215
|
}
|
|
193
216
|
catch (error) {
|
|
194
217
|
return {
|
|
195
|
-
|
|
196
|
-
|
|
218
|
+
content: [
|
|
219
|
+
{
|
|
220
|
+
type: 'text',
|
|
221
|
+
text: `❌ XPath query failed: ${error.message}`,
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
isError: true,
|
|
197
225
|
};
|
|
198
226
|
}
|
|
199
227
|
}
|
|
@@ -255,17 +283,25 @@ export async function handleAdvancedCSSSelectors(args) {
|
|
|
255
283
|
elements: results
|
|
256
284
|
};
|
|
257
285
|
}, selector, operation, returnType);
|
|
286
|
+
const resultText = `✅ Advanced CSS Selector Results\n\nSelector: ${selector}\nOperation: ${operation}\nElements Found: ${results.count}\n\nElements (first 10):\n${JSON.stringify(results.elements.slice(0, 10), null, 2)}`;
|
|
258
287
|
return {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
288
|
+
content: [
|
|
289
|
+
{
|
|
290
|
+
type: 'text',
|
|
291
|
+
text: resultText,
|
|
292
|
+
},
|
|
293
|
+
],
|
|
263
294
|
};
|
|
264
295
|
}
|
|
265
296
|
catch (error) {
|
|
266
297
|
return {
|
|
267
|
-
|
|
268
|
-
|
|
298
|
+
content: [
|
|
299
|
+
{
|
|
300
|
+
type: 'text',
|
|
301
|
+
text: `❌ CSS selector query failed: ${error.message}`,
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
isError: true,
|
|
269
305
|
};
|
|
270
306
|
}
|
|
271
307
|
}
|
|
@@ -381,16 +417,25 @@ export async function handleVisualElementFinder(args) {
|
|
|
381
417
|
topMatches: matches.slice(0, 20)
|
|
382
418
|
};
|
|
383
419
|
}, criteria);
|
|
420
|
+
const resultText = `✅ Visual Element Finder Results\n\nCriteria: ${JSON.stringify(criteria, null, 2)}\nTotal Matches: ${results.totalMatches}\n\nTop Matches:\n${JSON.stringify(results.topMatches, null, 2)}`;
|
|
384
421
|
return {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
422
|
+
content: [
|
|
423
|
+
{
|
|
424
|
+
type: 'text',
|
|
425
|
+
text: resultText,
|
|
426
|
+
},
|
|
427
|
+
],
|
|
388
428
|
};
|
|
389
429
|
}
|
|
390
430
|
catch (error) {
|
|
391
431
|
return {
|
|
392
|
-
|
|
393
|
-
|
|
432
|
+
content: [
|
|
433
|
+
{
|
|
434
|
+
type: 'text',
|
|
435
|
+
text: `❌ Visual element finder failed: ${error.message}`,
|
|
436
|
+
},
|
|
437
|
+
],
|
|
438
|
+
isError: true,
|
|
394
439
|
};
|
|
395
440
|
}
|
|
396
441
|
}
|
|
@@ -37,20 +37,25 @@ export async function handleFullPageScreenshot(args) {
|
|
|
37
37
|
const stats = await fs.stat(outputPath);
|
|
38
38
|
fileSize = stats.size;
|
|
39
39
|
}
|
|
40
|
+
const resultText = `✅ Screenshot captured successfully\n\nPath: ${outputPath}\nFormat: ${format}\nFull Page: ${fullPage}\nFile Size: ${(fileSize / 1024).toFixed(2)} KB\nTimestamp: ${new Date().toISOString()}`;
|
|
40
41
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
timestamp: new Date().toISOString()
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: resultText,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
51
|
return {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: `❌ Screenshot failed: ${error.message}`,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
isError: true,
|
|
54
59
|
};
|
|
55
60
|
}
|
|
56
61
|
}
|
|
@@ -122,22 +127,25 @@ export async function handleElementScreenshot(args) {
|
|
|
122
127
|
const stats = await fs.stat(outputPath);
|
|
123
128
|
fileSize = stats.size;
|
|
124
129
|
}
|
|
130
|
+
const resultText = `✅ Element screenshot captured successfully\n\nPath: ${outputPath}\nSelector: ${selector}\nFormat: ${format}\nPadding: ${padding}px\nElement: ${elementInfo?.tagName || 'unknown'}\nFile Size: ${(fileSize / 1024).toFixed(2)} KB\nTimestamp: ${new Date().toISOString()}`;
|
|
125
131
|
return {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
fileSize,
|
|
133
|
-
fileSizeKB: (fileSize / 1024).toFixed(2),
|
|
134
|
-
timestamp: new Date().toISOString()
|
|
132
|
+
content: [
|
|
133
|
+
{
|
|
134
|
+
type: 'text',
|
|
135
|
+
text: resultText,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
135
138
|
};
|
|
136
139
|
}
|
|
137
140
|
catch (error) {
|
|
138
141
|
return {
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
content: [
|
|
143
|
+
{
|
|
144
|
+
type: 'text',
|
|
145
|
+
text: `❌ Element screenshot failed: ${error.message}`,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
isError: true,
|
|
141
149
|
};
|
|
142
150
|
}
|
|
143
151
|
}
|
|
@@ -175,21 +183,25 @@ export async function handlePDFGeneration(args) {
|
|
|
175
183
|
const stats = await fs.stat(outputPath);
|
|
176
184
|
fileSize = stats.size;
|
|
177
185
|
}
|
|
186
|
+
const resultText = `✅ PDF generated successfully\n\nPath: ${outputPath}\nFormat: ${format}\nLandscape: ${landscape}\nFile Size: ${(fileSize / 1024).toFixed(2)} KB (${(fileSize / (1024 * 1024)).toFixed(2)} MB)\nTimestamp: ${new Date().toISOString()}`;
|
|
178
187
|
return {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
fileSizeMB: (fileSize / (1024 * 1024)).toFixed(2),
|
|
186
|
-
timestamp: new Date().toISOString()
|
|
188
|
+
content: [
|
|
189
|
+
{
|
|
190
|
+
type: 'text',
|
|
191
|
+
text: resultText,
|
|
192
|
+
},
|
|
193
|
+
],
|
|
187
194
|
};
|
|
188
195
|
}
|
|
189
196
|
catch (error) {
|
|
190
197
|
return {
|
|
191
|
-
|
|
192
|
-
|
|
198
|
+
content: [
|
|
199
|
+
{
|
|
200
|
+
type: 'text',
|
|
201
|
+
text: `❌ PDF generation failed: ${error.message}`,
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
isError: true,
|
|
193
205
|
};
|
|
194
206
|
}
|
|
195
207
|
}
|