n8n-nodes-smart-browser-automation 1.1.9 → 1.1.11
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.
|
@@ -235,7 +235,7 @@ class SmartBrowserAutomation {
|
|
|
235
235
|
const credentials = await this.getCredentials('smartBrowserAutomationApi');
|
|
236
236
|
await sessionManager.initialize(credentials.mcpEndpoint, true, input.endpoint);
|
|
237
237
|
return {
|
|
238
|
-
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.` }],
|
|
239
239
|
isError: false
|
|
240
240
|
};
|
|
241
241
|
}
|
|
@@ -318,13 +318,21 @@ class SmartBrowserAutomation {
|
|
|
318
318
|
console.warn(`Failed to auto-connect browser via tool: ${error.message}`);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
+
// Create a compact tool guide for the AI to fix hallucinations
|
|
322
|
+
// We prioritise showing the most important tools first
|
|
323
|
+
const coreTools = ['browser_navigate', 'browser_click', 'browser_type', 'browser_press_key', 'browser_scroll_to', 'browser_get_text', 'browser_take_screenshot', 'browser_evaluate'];
|
|
324
|
+
const toolGuide = tools
|
|
325
|
+
.filter(t => coreTools.includes(t.name))
|
|
326
|
+
.map(t => `- ${t.name}: ${(t.description || '').substring(0, 100)}`)
|
|
327
|
+
.join('\n');
|
|
328
|
+
const otherToolsCount = tools.length - coreTools.length;
|
|
321
329
|
returnData.push({
|
|
322
330
|
json: {
|
|
323
331
|
success: true,
|
|
324
332
|
message: `MCP session initialized at ${credentials.mcpEndpoint}`,
|
|
325
333
|
browserConnection: connectionStatus,
|
|
326
334
|
browserResponse: connectionResult,
|
|
327
|
-
|
|
335
|
+
toolGuide: `Available Tools (Top ${coreTools.length} of ${tools.length}):\n${toolGuide}\n...and ${otherToolsCount} more. Use these exact names!`,
|
|
328
336
|
},
|
|
329
337
|
pairedItem: i,
|
|
330
338
|
});
|
|
@@ -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 {
|