@oevortex/ddg_search 1.1.8 → 1.1.9
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/CHANGELOG.md +10 -4
- package/oevortex-ddg_search-1.1.9.tgz +0 -0
- package/package.json +1 -1
- package/src/tools/searchTool.js +40 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
## [1.1.
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
## [1.1.9] - 2025-12-21
|
|
5
|
+
### Fixed
|
|
6
|
+
- Fixed JSON parsing error in searchTool handler that caused "invalid character 'S' looking for beginning of value"
|
|
7
|
+
- Removed JSON.stringify approach and implemented formatted text output for web search results
|
|
8
|
+
- Improved result formatting to display numbered items, titles, URLs, snippets, and content consistently
|
|
9
|
+
|
|
10
|
+
## [1.1.8] - 2025-12-03
|
|
5
11
|
### Added
|
|
6
12
|
- Added new `getRandomUserAgent` function to rotate user agents
|
|
7
13
|
- Added new `src/utils/user_agents.js` file containing list of user agents
|
|
Binary file
|
package/package.json
CHANGED
package/src/tools/searchTool.js
CHANGED
|
@@ -37,19 +37,43 @@ export const searchToolDefinition = {
|
|
|
37
37
|
* @param {Object} params - The tool parameters
|
|
38
38
|
* @returns {Promise<Object>} - The tool result
|
|
39
39
|
*/
|
|
40
|
-
export async function searchToolHandler(params) {
|
|
41
|
-
const { query, numResults = 3, mode = 'short' } = params;
|
|
42
|
-
console.log(`Searching for: ${query} (${numResults} results, mode: ${mode})`);
|
|
43
|
-
|
|
44
|
-
const results = await searchDuckDuckGo(query, numResults, mode);
|
|
45
|
-
console.log(`Found ${results.length} results`);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
export async function searchToolHandler(params) {
|
|
41
|
+
const { query, numResults = 3, mode = 'short' } = params;
|
|
42
|
+
console.log(`Searching for: ${query} (${numResults} results, mode: ${mode})`);
|
|
43
|
+
|
|
44
|
+
const results = await searchDuckDuckGo(query, numResults, mode);
|
|
45
|
+
console.log(`Found ${results.length} results`);
|
|
46
|
+
|
|
47
|
+
// Format results as readable text, similar to other search tools
|
|
48
|
+
const formattedResults = results.map((result, index) => {
|
|
49
|
+
let formatted = `${index + 1}. **${result.title}**\n`;
|
|
50
|
+
formatted += `URL: ${result.url}\n`;
|
|
51
|
+
|
|
52
|
+
if (result.displayUrl) {
|
|
53
|
+
formatted += `Display URL: ${result.displayUrl}\n`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (result.snippet) {
|
|
57
|
+
formatted += `Snippet: ${result.snippet}\n`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (mode === 'detailed' && result.description) {
|
|
61
|
+
formatted += `Content: ${result.description}\n`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (result.favicon) {
|
|
65
|
+
formatted += `Favicon: ${result.favicon}\n`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return formatted;
|
|
69
|
+
}).join('\n');
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
content: [
|
|
73
|
+
{
|
|
74
|
+
type: 'text',
|
|
75
|
+
text: formattedResults || 'No results found.'
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
};
|
|
79
|
+
}
|