// 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 ===');