()
| 2 | import path from 'path'; |
| 3 | |
| 4 | export async function getAvailableTools() { |
| 5 | // Construct the path containing all tools folders. |
| 6 | const toolsPath = path.join(process.cwd(), 'baseai', 'tools'); |
| 7 | |
| 8 | // Check if the baseai directory exists. |
| 9 | if (!fs.existsSync(toolsPath)) return []; |
| 10 | |
| 11 | // Get all directories names in the tool path. |
| 12 | const toolsNames = await fs.promises.readdir(toolsPath); |
| 13 | |
| 14 | // Make complete paths for each tool. |
| 15 | const toolsPaths = toolsNames.map(toolName => toolName.replace('.ts', '')); |
| 16 | |
| 17 | // Return the tool names. |
| 18 | return toolsPaths; |
| 19 | } |
no outgoing calls
no test coverage detected