n8n-nodes-smart-browser-automation 1.0.0 → 1.0.2
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.
|
@@ -6,6 +6,6 @@ export declare class SmartBrowserAutomation implements INodeType {
|
|
|
6
6
|
getAvailableTools(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
getTools
|
|
9
|
+
getTools(this: IExecuteFunctions): Promise<any[]>;
|
|
10
10
|
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
11
11
|
}
|
|
@@ -19,12 +19,14 @@ class SmartBrowserAutomation {
|
|
|
19
19
|
},
|
|
20
20
|
inputs: ['main'],
|
|
21
21
|
outputs: ['main'],
|
|
22
|
+
icon: 'fa:browser',
|
|
22
23
|
credentials: [
|
|
23
24
|
{
|
|
24
25
|
name: 'smartBrowserAutomationApi',
|
|
25
26
|
required: true,
|
|
26
27
|
},
|
|
27
28
|
],
|
|
29
|
+
usableAsTool: true,
|
|
28
30
|
properties: [
|
|
29
31
|
{
|
|
30
32
|
displayName: 'Mode',
|
|
@@ -113,20 +115,33 @@ class SmartBrowserAutomation {
|
|
|
113
115
|
loadOptions: {
|
|
114
116
|
// Populate tool dropdown in manual mode
|
|
115
117
|
async getAvailableTools() {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
try {
|
|
119
|
+
const credentials = await this.getCredentials('smartBrowserAutomationApi');
|
|
120
|
+
const sessionManager = BrowserSessionManager_1.default.getInstance();
|
|
121
|
+
const tools = await sessionManager.initialize(credentials.mcpEndpoint, credentials.browserMode === 'cdp', credentials.cdpEndpoint);
|
|
122
|
+
if (!tools || tools.length === 0) {
|
|
123
|
+
return [{ name: 'No Tools Found - Check MCP Server', value: 'none' }];
|
|
124
|
+
}
|
|
125
|
+
return tools.map((tool) => ({
|
|
126
|
+
name: tool.name.split('_').map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(' '),
|
|
127
|
+
value: tool.name,
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
return [{ name: `Error: ${error.message}`, value: 'error' }];
|
|
132
|
+
}
|
|
123
133
|
},
|
|
124
134
|
},
|
|
125
135
|
};
|
|
126
136
|
// Expose tools to AI Agent nodes
|
|
127
137
|
async getTools() {
|
|
128
138
|
const credentials = await this.getCredentials('smartBrowserAutomationApi');
|
|
129
|
-
|
|
139
|
+
const tools = await (0, DynamicBrowserTools_1.createDynamicBrowserTools)(credentials);
|
|
140
|
+
// Ensure tools have the required structure for n8n AI node
|
|
141
|
+
return tools.map(tool => ({
|
|
142
|
+
...tool,
|
|
143
|
+
// n8n expects name, description and properties at the top level
|
|
144
|
+
}));
|
|
130
145
|
}
|
|
131
146
|
async execute() {
|
|
132
147
|
const items = this.getInputData();
|