brave-real-browser-mcp-server 2.8.3 → 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
- return {
71
- success: true,
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
  }
@@ -203,16 +203,25 @@ export async function handleXPathSupport(args) {
203
203
  elements
204
204
  };
205
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)}`;
206
207
  return {
207
- success: true,
208
- xpath,
209
- ...results
208
+ content: [
209
+ {
210
+ type: 'text',
211
+ text: resultText,
212
+ },
213
+ ],
210
214
  };
211
215
  }
212
216
  catch (error) {
213
217
  return {
214
- success: false,
215
- error: error.message
218
+ content: [
219
+ {
220
+ type: 'text',
221
+ text: `❌ XPath query failed: ${error.message}`,
222
+ },
223
+ ],
224
+ isError: true,
216
225
  };
217
226
  }
218
227
  }
@@ -274,17 +283,25 @@ export async function handleAdvancedCSSSelectors(args) {
274
283
  elements: results
275
284
  };
276
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)}`;
277
287
  return {
278
- success: true,
279
- selector,
280
- operation,
281
- ...results
288
+ content: [
289
+ {
290
+ type: 'text',
291
+ text: resultText,
292
+ },
293
+ ],
282
294
  };
283
295
  }
284
296
  catch (error) {
285
297
  return {
286
- success: false,
287
- error: error.message
298
+ content: [
299
+ {
300
+ type: 'text',
301
+ text: `❌ CSS selector query failed: ${error.message}`,
302
+ },
303
+ ],
304
+ isError: true,
288
305
  };
289
306
  }
290
307
  }
@@ -400,16 +417,25 @@ export async function handleVisualElementFinder(args) {
400
417
  topMatches: matches.slice(0, 20)
401
418
  };
402
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)}`;
403
421
  return {
404
- success: true,
405
- criteria,
406
- ...results
422
+ content: [
423
+ {
424
+ type: 'text',
425
+ text: resultText,
426
+ },
427
+ ],
407
428
  };
408
429
  }
409
430
  catch (error) {
410
431
  return {
411
- success: false,
412
- error: error.message
432
+ content: [
433
+ {
434
+ type: 'text',
435
+ text: `❌ Visual element finder failed: ${error.message}`,
436
+ },
437
+ ],
438
+ isError: true,
413
439
  };
414
440
  }
415
441
  }
@@ -127,22 +127,25 @@ export async function handleElementScreenshot(args) {
127
127
  const stats = await fs.stat(outputPath);
128
128
  fileSize = stats.size;
129
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()}`;
130
131
  return {
131
- success: true,
132
- path: outputPath,
133
- selector,
134
- format,
135
- padding,
136
- element: elementInfo,
137
- fileSize,
138
- fileSizeKB: (fileSize / 1024).toFixed(2),
139
- timestamp: new Date().toISOString()
132
+ content: [
133
+ {
134
+ type: 'text',
135
+ text: resultText,
136
+ },
137
+ ],
140
138
  };
141
139
  }
142
140
  catch (error) {
143
141
  return {
144
- success: false,
145
- error: error.message
142
+ content: [
143
+ {
144
+ type: 'text',
145
+ text: `❌ Element screenshot failed: ${error.message}`,
146
+ },
147
+ ],
148
+ isError: true,
146
149
  };
147
150
  }
148
151
  }
@@ -180,21 +183,25 @@ export async function handlePDFGeneration(args) {
180
183
  const stats = await fs.stat(outputPath);
181
184
  fileSize = stats.size;
182
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()}`;
183
187
  return {
184
- success: true,
185
- path: outputPath,
186
- format,
187
- landscape,
188
- fileSize,
189
- fileSizeKB: (fileSize / 1024).toFixed(2),
190
- fileSizeMB: (fileSize / (1024 * 1024)).toFixed(2),
191
- timestamp: new Date().toISOString()
188
+ content: [
189
+ {
190
+ type: 'text',
191
+ text: resultText,
192
+ },
193
+ ],
192
194
  };
193
195
  }
194
196
  catch (error) {
195
197
  return {
196
- success: false,
197
- error: error.message
198
+ content: [
199
+ {
200
+ type: 'text',
201
+ text: `❌ PDF generation failed: ${error.message}`,
202
+ },
203
+ ],
204
+ isError: true,
198
205
  };
199
206
  }
200
207
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brave-real-browser-mcp-server",
3
- "version": "2.8.3",
3
+ "version": "2.8.4",
4
4
  "description": "MCP server for brave-real-browser",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",