Skip to content

Commit b6f900d

Browse files
committed
Fix the executeTool function to use tool meta data instead of trying to reverse engineer from toolName
1 parent d014590 commit b6f900d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

mcp-openapi/src/package-info.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import fs from 'fs';
22
import path from 'path';
3-
import { fileURLToPath } from 'url';
43

54
// Interface for package.json structure
65
interface PackageInfo {
@@ -19,16 +18,14 @@ function loadPackageInfo(): PackageInfo {
1918
return packageInfo;
2019
}
2120

22-
// Get ES module equivalent of __dirname
23-
const __filename = fileURLToPath(import.meta.url);
24-
const __dirname = path.dirname(__filename);
25-
2621
// Look for package.json in the project root
2722
// Try multiple possible locations to be robust
2823
const possiblePaths = [
29-
path.resolve(process.cwd(), 'package.json'),
30-
path.resolve(__dirname, '..', 'package.json'),
31-
path.resolve(__dirname, '..', '..', 'package.json')
24+
path.resolve(process.cwd(), 'package.json'), // When running from mcp-openapi/
25+
path.resolve(process.cwd(), 'mcp-openapi', 'package.json'), // When running from API2MCP/
26+
path.resolve('.', 'package.json'), // Current directory
27+
path.resolve('..', 'package.json'), // Parent directory (from dist/)
28+
path.resolve('../..', 'package.json') // Grandparent directory (from dist/src/)
3229
];
3330

3431
try {

0 commit comments

Comments
 (0)