n8n-nodes-smart-browser-automation 1.3.0 → 1.3.1
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.
|
@@ -51,6 +51,7 @@ async function createDynamicBrowserTools(credentials) {
|
|
|
51
51
|
const sessionManager = BrowserSessionManager_1.default.getInstance();
|
|
52
52
|
// Initialize and get MCP tools
|
|
53
53
|
const mcpTools = await sessionManager.initialize(credentials.mcpEndpoint, credentials.browserMode === 'cdp', credentials.cdpEndpoint);
|
|
54
|
+
console.log(`[DynamicTools] Fetched ${mcpTools.length} tools from MCP server`);
|
|
54
55
|
// Create n8n tool for each MCP tool
|
|
55
56
|
const n8nTools = mcpTools.map((mcpTool) => {
|
|
56
57
|
const toolName = mcpTool.name;
|
|
@@ -58,18 +59,26 @@ async function createDynamicBrowserTools(credentials) {
|
|
|
58
59
|
.split('_')
|
|
59
60
|
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
|
|
60
61
|
.join(' ');
|
|
62
|
+
// Use MCP's description or create a better one
|
|
63
|
+
let description = mcpTool.description;
|
|
64
|
+
if (!description || description.trim() === '') {
|
|
65
|
+
description = `Execute ${displayName} action in the browser.`;
|
|
66
|
+
}
|
|
67
|
+
console.log(`[DynamicTools] Tool: ${toolName}, Description: ${description.substring(0, 100)}...`);
|
|
61
68
|
return {
|
|
62
69
|
name: toolName,
|
|
63
70
|
displayName: displayName,
|
|
64
|
-
description:
|
|
71
|
+
description: description,
|
|
65
72
|
properties: mcpSchemaToN8nProperties(mcpTool.inputSchema),
|
|
66
73
|
async execute(toolInput) {
|
|
67
74
|
try {
|
|
68
|
-
console.log(`[AI Agent] Executing tool: ${toolName}
|
|
75
|
+
console.log(`[AI Agent] Executing tool: ${toolName} with input:`, JSON.stringify(toolInput));
|
|
69
76
|
const result = await sessionManager.callTool(toolName, toolInput);
|
|
77
|
+
console.log(`[AI Agent] Tool ${toolName} result:`, JSON.stringify(result).substring(0, 200));
|
|
70
78
|
return result;
|
|
71
79
|
}
|
|
72
80
|
catch (error) {
|
|
81
|
+
console.error(`[AI Agent] Tool ${toolName} error:`, error.message);
|
|
73
82
|
throw new Error(error.message || 'Unknown error occurred');
|
|
74
83
|
}
|
|
75
84
|
}
|