n8n-nodes-smart-browser-automation 1.1.8 → 1.1.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.
|
@@ -202,6 +202,19 @@ class SmartBrowserAutomation {
|
|
|
202
202
|
if (enabledTools.length > 0) {
|
|
203
203
|
tools = tools.filter(tool => enabledTools.includes(tool.name));
|
|
204
204
|
}
|
|
205
|
+
// Sort tools to prioritize core actions
|
|
206
|
+
const priorityTools = ['browser_navigate', 'browser_click', 'browser_type', 'browser_press_key', 'browser_scroll_to', 'browser_get_text'];
|
|
207
|
+
tools.sort((a, b) => {
|
|
208
|
+
const indexA = priorityTools.indexOf(a.name);
|
|
209
|
+
const indexB = priorityTools.indexOf(b.name);
|
|
210
|
+
if (indexA !== -1 && indexB !== -1)
|
|
211
|
+
return indexA - indexB;
|
|
212
|
+
if (indexA !== -1)
|
|
213
|
+
return -1;
|
|
214
|
+
if (indexB !== -1)
|
|
215
|
+
return 1;
|
|
216
|
+
return a.name.localeCompare(b.name);
|
|
217
|
+
});
|
|
205
218
|
// Add a custom tool for the AI to connect to a specific CDP URL
|
|
206
219
|
const connectTool = {
|
|
207
220
|
name: 'browser_connect_cdp',
|
|
@@ -222,7 +235,7 @@ class SmartBrowserAutomation {
|
|
|
222
235
|
const credentials = await this.getCredentials('smartBrowserAutomationApi');
|
|
223
236
|
await sessionManager.initialize(credentials.mcpEndpoint, true, input.endpoint);
|
|
224
237
|
return {
|
|
225
|
-
content: [{ type: 'text', text: `
|
|
238
|
+
content: [{ type: 'text', text: `Connected to browser at ${input.endpoint}. You can now use tools like browser_navigate, browser_click, browser_type, etc.` }],
|
|
226
239
|
isError: false
|
|
227
240
|
};
|
|
228
241
|
}
|
|
@@ -312,7 +325,6 @@ class SmartBrowserAutomation {
|
|
|
312
325
|
browserConnection: connectionStatus,
|
|
313
326
|
browserResponse: connectionResult,
|
|
314
327
|
totalToolsAvailable: tools.length,
|
|
315
|
-
availableTools: tools.map(t => t.name),
|
|
316
328
|
},
|
|
317
329
|
pairedItem: i,
|
|
318
330
|
});
|
|
@@ -61,7 +61,7 @@ async function createDynamicBrowserTools(credentials) {
|
|
|
61
61
|
return {
|
|
62
62
|
name: toolName,
|
|
63
63
|
displayName: displayName,
|
|
64
|
-
description: mcpTool.description || `Execute ${displayName} browser
|
|
64
|
+
description: mcpTool.description || `Execute ${displayName} action in the browser. Use this tool when you need to ${displayName.toLowerCase()}.`,
|
|
65
65
|
properties: mcpSchemaToN8nProperties(mcpTool.inputSchema),
|
|
66
66
|
async execute(toolInput) {
|
|
67
67
|
try {
|