brave-real-browser-mcp-server 2.8.4 → 2.8.5
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.
|
@@ -120,11 +120,13 @@ export async function handleContentClassification(args) {
|
|
|
120
120
|
return { category: cat.name, score };
|
|
121
121
|
});
|
|
122
122
|
scores.sort((a, b) => b.score - a.score);
|
|
123
|
+
const confidence = scores[0].score / (scores.reduce((sum, s) => sum + s.score, 0) || 1);
|
|
124
|
+
const resultText = `✅ Content Classification\n\nPrimary Category: ${scores[0].category} (Score: ${scores[0].score})\nConfidence: ${(confidence * 100).toFixed(2)}%\n\nAll Categories:\n${JSON.stringify(scores.slice(0, 5), null, 2)}`;
|
|
123
125
|
return {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
content: [{
|
|
127
|
+
type: 'text',
|
|
128
|
+
text: resultText
|
|
129
|
+
}]
|
|
128
130
|
};
|
|
129
131
|
}
|
|
130
132
|
catch (error) {
|
|
@@ -173,23 +175,18 @@ export async function handleSentimentAnalysis(args) {
|
|
|
173
175
|
sentiment: s.score > 0 ? 'positive' : s.score < 0 ? 'negative' : 'neutral'
|
|
174
176
|
};
|
|
175
177
|
});
|
|
178
|
+
const stats = {
|
|
179
|
+
totalSentences: sentences.length,
|
|
180
|
+
positiveSentences: sentenceSentiments.filter(s => s.sentiment === 'positive').length,
|
|
181
|
+
negativeSentences: sentenceSentiments.filter(s => s.sentiment === 'negative').length,
|
|
182
|
+
neutralSentences: sentenceSentiments.filter(s => s.sentiment === 'neutral').length
|
|
183
|
+
};
|
|
184
|
+
const resultText = `✅ Sentiment Analysis\n\nOverall Sentiment: ${result.score > 0 ? 'Positive' : result.score < 0 ? 'Negative' : 'Neutral'}\nScore: ${result.score}\nComparative: ${result.comparative.toFixed(4)}\n\nStatistics:\n- Total Sentences: ${stats.totalSentences}\n- Positive: ${stats.positiveSentences}\n- Negative: ${stats.negativeSentences}\n- Neutral: ${stats.neutralSentences}\n\nPositive Words: ${result.positive.join(', ')}\nNegative Words: ${result.negative.join(', ')}`;
|
|
176
185
|
return {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
sentiment: result.score > 0 ? 'positive' : result.score < 0 ? 'negative' : 'neutral',
|
|
182
|
-
tokens: result.tokens.length,
|
|
183
|
-
positive: result.positive,
|
|
184
|
-
negative: result.negative
|
|
185
|
-
},
|
|
186
|
-
sentences: sentenceSentiments,
|
|
187
|
-
statistics: {
|
|
188
|
-
totalSentences: sentences.length,
|
|
189
|
-
positiveSentences: sentenceSentiments.filter(s => s.sentiment === 'positive').length,
|
|
190
|
-
negativeSentences: sentenceSentiments.filter(s => s.sentiment === 'negative').length,
|
|
191
|
-
neutralSentences: sentenceSentiments.filter(s => s.sentiment === 'neutral').length
|
|
192
|
-
}
|
|
186
|
+
content: [{
|
|
187
|
+
type: 'text',
|
|
188
|
+
text: resultText
|
|
189
|
+
}]
|
|
193
190
|
};
|
|
194
191
|
}
|
|
195
192
|
catch (error) {
|
|
@@ -254,20 +251,13 @@ export async function handleSummaryGenerator(args) {
|
|
|
254
251
|
// Sort by original order
|
|
255
252
|
topSentences.sort((a, b) => a.index - b.index);
|
|
256
253
|
const summary = topSentences.map(s => s.sentence).join(' ');
|
|
254
|
+
const compressionRatio = (summary.length / content.length * 100).toFixed(2);
|
|
255
|
+
const resultText = `✅ Summary Generated\n\nSummary:\n${summary}\n\nStatistics:\n- Original Length: ${content.length} characters\n- Summary Length: ${summary.length} characters\n- Compression Ratio: ${compressionRatio}%\n- Original Sentences: ${sentences.length}\n- Summary Sentences: ${topSentences.length}`;
|
|
257
256
|
return {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
compressionRatio: (summary.length / content.length * 100).toFixed(2) + '%',
|
|
263
|
-
sentenceCount: {
|
|
264
|
-
original: sentences.length,
|
|
265
|
-
summary: topSentences.length
|
|
266
|
-
},
|
|
267
|
-
topScoredSentences: topSentences.map(s => ({
|
|
268
|
-
sentence: s.sentence,
|
|
269
|
-
score: s.score.toFixed(2)
|
|
270
|
-
}))
|
|
257
|
+
content: [{
|
|
258
|
+
type: 'text',
|
|
259
|
+
text: resultText
|
|
260
|
+
}]
|
|
271
261
|
};
|
|
272
262
|
}
|
|
273
263
|
catch (error) {
|
|
@@ -328,18 +318,13 @@ export async function handleTranslationSupport(args) {
|
|
|
328
318
|
const keyPhrases = tfidf.listTerms(0)
|
|
329
319
|
.slice(0, 10)
|
|
330
320
|
.map(term => term.term);
|
|
321
|
+
const needsTranslation = detectedLang !== targetLanguage && detectedLang !== 'und';
|
|
322
|
+
const resultText = `✅ Translation Support\n\nDetected Language: ${languageName} (${detectedLang})\nTarget Language: ${targetLanguage}\nNeeds Translation: ${needsTranslation ? 'Yes' : 'No'}\n\nContent Length: ${contentToTranslate.length} characters\nContent Preview: ${contentToTranslate.substring(0, 200)}...\n\nKey Phrases: ${keyPhrases.join(', ')}\n\nNote: Use external translation API (Google Translate, DeepL) for actual translation`;
|
|
331
323
|
return {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
},
|
|
337
|
-
targetLanguage,
|
|
338
|
-
needsTranslation: detectedLang !== targetLanguage && detectedLang !== 'und',
|
|
339
|
-
contentPreview: contentToTranslate.substring(0, 200),
|
|
340
|
-
contentLength: contentToTranslate.length,
|
|
341
|
-
keyPhrases,
|
|
342
|
-
translationNote: 'Use external translation API (Google Translate, DeepL) for actual translation'
|
|
324
|
+
content: [{
|
|
325
|
+
type: 'text',
|
|
326
|
+
text: resultText
|
|
327
|
+
}]
|
|
343
328
|
};
|
|
344
329
|
}
|
|
345
330
|
catch (error) {
|