UNPKG

rhombus-node-mcp

Version:
23 lines (22 loc) 712 B
import { fileURLToPath } from "node:url"; import path from "path"; import { getFilePathsInDirectory } from "../util.js"; async function getTools() { const currentDir = path.dirname(fileURLToPath(import.meta.url)); const filePaths = getFilePathsInDirectory(currentDir); const tools = []; for (const filePath of filePaths) { // ensure it's a js file if (!filePath.endsWith(".js")) continue; const imported = (await import(filePath)); if (imported.createTool !== undefined) { tools.push({ name: filePath, create: imported.createTool, }); } } return tools; } export default getTools;