aboutsummaryrefslogtreecommitdiff
path: root/test_dynamic_tools.js
diff options
context:
space:
mode:
Diffstat (limited to 'test_dynamic_tools.js')
-rw-r--r--test_dynamic_tools.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/test_dynamic_tools.js b/test_dynamic_tools.js
new file mode 100644
index 000000000..b0d6844f3
--- /dev/null
+++ b/test_dynamic_tools.js
@@ -0,0 +1,44 @@
+// Quick test script to verify dynamic tool loading
+const fs = require('fs');
+const path = require('path');
+
+console.log('=== Testing Dynamic Tool Loading ===');
+
+// Check if the dynamic tools directory exists
+const dynamicToolsPath = path.join(__dirname, 'src/client/views/nodes/chatbot/tools/dynamic');
+console.log('Dynamic tools directory:', dynamicToolsPath);
+console.log('Directory exists:', fs.existsSync(dynamicToolsPath));
+
+if (fs.existsSync(dynamicToolsPath)) {
+ const files = fs.readdirSync(dynamicToolsPath);
+ const toolFiles = files.filter(file => file.endsWith('.ts') && !file.startsWith('.'));
+
+ console.log('Found tool files:', toolFiles);
+
+ for (const toolFile of toolFiles) {
+ const toolPath = path.join(dynamicToolsPath, toolFile);
+ const toolName = path.basename(toolFile, '.ts');
+
+ console.log(`\nTesting ${toolFile}:`);
+ console.log(' - Tool name:', toolName);
+ console.log(' - File size:', fs.statSync(toolPath).size, 'bytes');
+
+ // Try to read and check the file content
+ try {
+ const content = fs.readFileSync(toolPath, 'utf8');
+
+ // Check for required patterns
+ const hasExport = content.includes(`export class ${toolName}`);
+ const toolInfoMatch = content.match(/const\s+\w+Info.*?=\s*{[^}]*name\s*:\s*['"]([^'"]+)['"]/s);
+ const hasExtends = content.includes('extends BaseTool');
+
+ console.log(' - Has export class:', hasExport);
+ console.log(' - Extends BaseTool:', hasExtends);
+ console.log(' - Tool info name:', toolInfoMatch ? toolInfoMatch[1] : 'NOT FOUND');
+ } catch (error) {
+ console.log(' - Error reading file:', error.message);
+ }
+ }
+}
+
+console.log('\n=== Test Complete ===');