@frontmcp/adapters 1.0.0-beta.1 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.mjs +47 -15
- package/esm/openapi/index.mjs +47 -15
- package/esm/package.json +4 -4
- package/index.js +47 -15
- package/openapi/index.js +47 -15
- package/openapi/openapi.adapter.d.ts +5 -0
- package/openapi/openapi.adapter.d.ts.map +1 -1
- package/package.json +4 -4
package/esm/index.mjs
CHANGED
|
@@ -1135,6 +1135,24 @@ Add one of the following to your adapter configuration:
|
|
|
1135
1135
|
if (this.options.toolTransforms) {
|
|
1136
1136
|
transformedTools = transformedTools.map((tool2) => this.applyToolTransforms(tool2));
|
|
1137
1137
|
}
|
|
1138
|
+
const nameMap = /* @__PURE__ */ new Map();
|
|
1139
|
+
for (const tool2 of transformedTools) {
|
|
1140
|
+
const meta = tool2.metadata;
|
|
1141
|
+
const source = `${meta["method"]?.toUpperCase() ?? "?"} ${meta["path"] ?? "?"}`;
|
|
1142
|
+
const existing = nameMap.get(tool2.name);
|
|
1143
|
+
if (existing) {
|
|
1144
|
+
existing.push(source);
|
|
1145
|
+
} else {
|
|
1146
|
+
nameMap.set(tool2.name, [source]);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
for (const [name, sources] of nameMap) {
|
|
1150
|
+
if (sources.length > 1) {
|
|
1151
|
+
throw new Error(
|
|
1152
|
+
`Tool name collision: "${name}" produced by ${sources.length} operations: ${sources.join(", ")}. Rename conflicting operations in your OpenAPI spec or use toolTransforms.perTool to assign unique names.`
|
|
1153
|
+
);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1138
1156
|
if (this.options.inputTransforms) {
|
|
1139
1157
|
transformedTools = transformedTools.map((tool2) => this.applyInputTransforms(tool2));
|
|
1140
1158
|
}
|
|
@@ -1217,6 +1235,15 @@ ${opDescription}`;
|
|
|
1217
1235
|
description
|
|
1218
1236
|
};
|
|
1219
1237
|
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Look up a value in a perTool map by tool name, using own-property check.
|
|
1240
|
+
* @private
|
|
1241
|
+
*/
|
|
1242
|
+
resolvePerTool(perTool, tool2) {
|
|
1243
|
+
if (!perTool) return void 0;
|
|
1244
|
+
if (Object.prototype.hasOwnProperty.call(perTool, tool2.name)) return perTool[tool2.name];
|
|
1245
|
+
return void 0;
|
|
1246
|
+
}
|
|
1220
1247
|
/**
|
|
1221
1248
|
* Collect tool transforms for a specific tool
|
|
1222
1249
|
* @private
|
|
@@ -1237,8 +1264,9 @@ ${opDescription}`;
|
|
|
1237
1264
|
result.examples = [...opts.global.examples];
|
|
1238
1265
|
}
|
|
1239
1266
|
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1267
|
+
const perToolMatch = this.resolvePerTool(opts.perTool, tool2);
|
|
1268
|
+
if (perToolMatch) {
|
|
1269
|
+
const perTool = perToolMatch;
|
|
1242
1270
|
if (perTool.name) result.name = perTool.name;
|
|
1243
1271
|
if (perTool.description) result.description = perTool.description;
|
|
1244
1272
|
if (perTool.hideFromDiscovery !== void 0) result.hideFromDiscovery = perTool.hideFromDiscovery;
|
|
@@ -1315,8 +1343,9 @@ ${opDescription}`;
|
|
|
1315
1343
|
if (opts.global) {
|
|
1316
1344
|
transforms.push(...opts.global);
|
|
1317
1345
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1346
|
+
const perToolInputTransforms = this.resolvePerTool(opts.perTool, tool2);
|
|
1347
|
+
if (perToolInputTransforms) {
|
|
1348
|
+
transforms.push(...perToolInputTransforms);
|
|
1320
1349
|
}
|
|
1321
1350
|
if (opts.generator) {
|
|
1322
1351
|
transforms.push(...opts.generator(tool2));
|
|
@@ -1463,8 +1492,9 @@ ${opDescription}`;
|
|
|
1463
1492
|
const generated = opts.generator(tool2);
|
|
1464
1493
|
if (generated) return generated;
|
|
1465
1494
|
}
|
|
1466
|
-
|
|
1467
|
-
|
|
1495
|
+
const perToolInputSchema = this.resolvePerTool(opts.perTool, tool2);
|
|
1496
|
+
if (perToolInputSchema) {
|
|
1497
|
+
return perToolInputSchema;
|
|
1468
1498
|
}
|
|
1469
1499
|
return opts.global;
|
|
1470
1500
|
}
|
|
@@ -1479,8 +1509,9 @@ ${opDescription}`;
|
|
|
1479
1509
|
const generated = opts.generator(tool2);
|
|
1480
1510
|
if (generated) return generated;
|
|
1481
1511
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1512
|
+
const perToolOutputSchema = this.resolvePerTool(opts.perTool, tool2);
|
|
1513
|
+
if (perToolOutputSchema) {
|
|
1514
|
+
return perToolOutputSchema;
|
|
1484
1515
|
}
|
|
1485
1516
|
return opts.global;
|
|
1486
1517
|
}
|
|
@@ -1582,8 +1613,9 @@ ${this.formatSchemaAsSummary(schema)}`;
|
|
|
1582
1613
|
if (opts.global) {
|
|
1583
1614
|
result = { ...opts.global };
|
|
1584
1615
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1616
|
+
const perToolPre = this.resolvePerTool(opts.perTool, tool2);
|
|
1617
|
+
if (perToolPre) {
|
|
1618
|
+
result = { ...result, ...perToolPre };
|
|
1587
1619
|
}
|
|
1588
1620
|
if (opts.generator) {
|
|
1589
1621
|
const generated = opts.generator(tool2);
|
|
@@ -1604,12 +1636,12 @@ ${this.formatSchemaAsSummary(schema)}`;
|
|
|
1604
1636
|
if (opts.global) {
|
|
1605
1637
|
result = { ...opts.global };
|
|
1606
1638
|
}
|
|
1607
|
-
|
|
1608
|
-
|
|
1639
|
+
const perToolPost = this.resolvePerTool(opts.perTool, tool2);
|
|
1640
|
+
if (perToolPost) {
|
|
1609
1641
|
result = result ? {
|
|
1610
|
-
transform:
|
|
1611
|
-
filter:
|
|
1612
|
-
} :
|
|
1642
|
+
transform: perToolPost.transform,
|
|
1643
|
+
filter: perToolPost.filter ?? result.filter
|
|
1644
|
+
} : perToolPost;
|
|
1613
1645
|
}
|
|
1614
1646
|
if (opts.generator) {
|
|
1615
1647
|
const generated = opts.generator(tool2);
|
package/esm/openapi/index.mjs
CHANGED
|
@@ -1135,6 +1135,24 @@ Add one of the following to your adapter configuration:
|
|
|
1135
1135
|
if (this.options.toolTransforms) {
|
|
1136
1136
|
transformedTools = transformedTools.map((tool2) => this.applyToolTransforms(tool2));
|
|
1137
1137
|
}
|
|
1138
|
+
const nameMap = /* @__PURE__ */ new Map();
|
|
1139
|
+
for (const tool2 of transformedTools) {
|
|
1140
|
+
const meta = tool2.metadata;
|
|
1141
|
+
const source = `${meta["method"]?.toUpperCase() ?? "?"} ${meta["path"] ?? "?"}`;
|
|
1142
|
+
const existing = nameMap.get(tool2.name);
|
|
1143
|
+
if (existing) {
|
|
1144
|
+
existing.push(source);
|
|
1145
|
+
} else {
|
|
1146
|
+
nameMap.set(tool2.name, [source]);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
for (const [name, sources] of nameMap) {
|
|
1150
|
+
if (sources.length > 1) {
|
|
1151
|
+
throw new Error(
|
|
1152
|
+
`Tool name collision: "${name}" produced by ${sources.length} operations: ${sources.join(", ")}. Rename conflicting operations in your OpenAPI spec or use toolTransforms.perTool to assign unique names.`
|
|
1153
|
+
);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1138
1156
|
if (this.options.inputTransforms) {
|
|
1139
1157
|
transformedTools = transformedTools.map((tool2) => this.applyInputTransforms(tool2));
|
|
1140
1158
|
}
|
|
@@ -1217,6 +1235,15 @@ ${opDescription}`;
|
|
|
1217
1235
|
description
|
|
1218
1236
|
};
|
|
1219
1237
|
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Look up a value in a perTool map by tool name, using own-property check.
|
|
1240
|
+
* @private
|
|
1241
|
+
*/
|
|
1242
|
+
resolvePerTool(perTool, tool2) {
|
|
1243
|
+
if (!perTool) return void 0;
|
|
1244
|
+
if (Object.prototype.hasOwnProperty.call(perTool, tool2.name)) return perTool[tool2.name];
|
|
1245
|
+
return void 0;
|
|
1246
|
+
}
|
|
1220
1247
|
/**
|
|
1221
1248
|
* Collect tool transforms for a specific tool
|
|
1222
1249
|
* @private
|
|
@@ -1237,8 +1264,9 @@ ${opDescription}`;
|
|
|
1237
1264
|
result.examples = [...opts.global.examples];
|
|
1238
1265
|
}
|
|
1239
1266
|
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1267
|
+
const perToolMatch = this.resolvePerTool(opts.perTool, tool2);
|
|
1268
|
+
if (perToolMatch) {
|
|
1269
|
+
const perTool = perToolMatch;
|
|
1242
1270
|
if (perTool.name) result.name = perTool.name;
|
|
1243
1271
|
if (perTool.description) result.description = perTool.description;
|
|
1244
1272
|
if (perTool.hideFromDiscovery !== void 0) result.hideFromDiscovery = perTool.hideFromDiscovery;
|
|
@@ -1315,8 +1343,9 @@ ${opDescription}`;
|
|
|
1315
1343
|
if (opts.global) {
|
|
1316
1344
|
transforms.push(...opts.global);
|
|
1317
1345
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1346
|
+
const perToolInputTransforms = this.resolvePerTool(opts.perTool, tool2);
|
|
1347
|
+
if (perToolInputTransforms) {
|
|
1348
|
+
transforms.push(...perToolInputTransforms);
|
|
1320
1349
|
}
|
|
1321
1350
|
if (opts.generator) {
|
|
1322
1351
|
transforms.push(...opts.generator(tool2));
|
|
@@ -1463,8 +1492,9 @@ ${opDescription}`;
|
|
|
1463
1492
|
const generated = opts.generator(tool2);
|
|
1464
1493
|
if (generated) return generated;
|
|
1465
1494
|
}
|
|
1466
|
-
|
|
1467
|
-
|
|
1495
|
+
const perToolInputSchema = this.resolvePerTool(opts.perTool, tool2);
|
|
1496
|
+
if (perToolInputSchema) {
|
|
1497
|
+
return perToolInputSchema;
|
|
1468
1498
|
}
|
|
1469
1499
|
return opts.global;
|
|
1470
1500
|
}
|
|
@@ -1479,8 +1509,9 @@ ${opDescription}`;
|
|
|
1479
1509
|
const generated = opts.generator(tool2);
|
|
1480
1510
|
if (generated) return generated;
|
|
1481
1511
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1512
|
+
const perToolOutputSchema = this.resolvePerTool(opts.perTool, tool2);
|
|
1513
|
+
if (perToolOutputSchema) {
|
|
1514
|
+
return perToolOutputSchema;
|
|
1484
1515
|
}
|
|
1485
1516
|
return opts.global;
|
|
1486
1517
|
}
|
|
@@ -1582,8 +1613,9 @@ ${this.formatSchemaAsSummary(schema)}`;
|
|
|
1582
1613
|
if (opts.global) {
|
|
1583
1614
|
result = { ...opts.global };
|
|
1584
1615
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1616
|
+
const perToolPre = this.resolvePerTool(opts.perTool, tool2);
|
|
1617
|
+
if (perToolPre) {
|
|
1618
|
+
result = { ...result, ...perToolPre };
|
|
1587
1619
|
}
|
|
1588
1620
|
if (opts.generator) {
|
|
1589
1621
|
const generated = opts.generator(tool2);
|
|
@@ -1604,12 +1636,12 @@ ${this.formatSchemaAsSummary(schema)}`;
|
|
|
1604
1636
|
if (opts.global) {
|
|
1605
1637
|
result = { ...opts.global };
|
|
1606
1638
|
}
|
|
1607
|
-
|
|
1608
|
-
|
|
1639
|
+
const perToolPost = this.resolvePerTool(opts.perTool, tool2);
|
|
1640
|
+
if (perToolPost) {
|
|
1609
1641
|
result = result ? {
|
|
1610
|
-
transform:
|
|
1611
|
-
filter:
|
|
1612
|
-
} :
|
|
1642
|
+
transform: perToolPost.transform,
|
|
1643
|
+
filter: perToolPost.filter ?? result.filter
|
|
1644
|
+
} : perToolPost;
|
|
1613
1645
|
}
|
|
1614
1646
|
if (opts.generator) {
|
|
1615
1647
|
const generated = opts.generator(tool2);
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/adapters",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"description": "Adapters for the FrontMCP framework",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"./esm": null
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
54
|
+
"node": ">=24.0.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@frontmcp/utils": "1.0.0-beta.
|
|
58
|
-
"@frontmcp/sdk": "1.0.0-beta.
|
|
57
|
+
"@frontmcp/utils": "1.0.0-beta.10",
|
|
58
|
+
"@frontmcp/sdk": "1.0.0-beta.10",
|
|
59
59
|
"zod": "^4.0.0",
|
|
60
60
|
"openapi-types": "^12.1.3",
|
|
61
61
|
"mcp-from-openapi": "2.1.2",
|
package/index.js
CHANGED
|
@@ -1163,6 +1163,24 @@ Add one of the following to your adapter configuration:
|
|
|
1163
1163
|
if (this.options.toolTransforms) {
|
|
1164
1164
|
transformedTools = transformedTools.map((tool2) => this.applyToolTransforms(tool2));
|
|
1165
1165
|
}
|
|
1166
|
+
const nameMap = /* @__PURE__ */ new Map();
|
|
1167
|
+
for (const tool2 of transformedTools) {
|
|
1168
|
+
const meta = tool2.metadata;
|
|
1169
|
+
const source = `${meta["method"]?.toUpperCase() ?? "?"} ${meta["path"] ?? "?"}`;
|
|
1170
|
+
const existing = nameMap.get(tool2.name);
|
|
1171
|
+
if (existing) {
|
|
1172
|
+
existing.push(source);
|
|
1173
|
+
} else {
|
|
1174
|
+
nameMap.set(tool2.name, [source]);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
for (const [name, sources] of nameMap) {
|
|
1178
|
+
if (sources.length > 1) {
|
|
1179
|
+
throw new Error(
|
|
1180
|
+
`Tool name collision: "${name}" produced by ${sources.length} operations: ${sources.join(", ")}. Rename conflicting operations in your OpenAPI spec or use toolTransforms.perTool to assign unique names.`
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1166
1184
|
if (this.options.inputTransforms) {
|
|
1167
1185
|
transformedTools = transformedTools.map((tool2) => this.applyInputTransforms(tool2));
|
|
1168
1186
|
}
|
|
@@ -1245,6 +1263,15 @@ ${opDescription}`;
|
|
|
1245
1263
|
description
|
|
1246
1264
|
};
|
|
1247
1265
|
}
|
|
1266
|
+
/**
|
|
1267
|
+
* Look up a value in a perTool map by tool name, using own-property check.
|
|
1268
|
+
* @private
|
|
1269
|
+
*/
|
|
1270
|
+
resolvePerTool(perTool, tool2) {
|
|
1271
|
+
if (!perTool) return void 0;
|
|
1272
|
+
if (Object.prototype.hasOwnProperty.call(perTool, tool2.name)) return perTool[tool2.name];
|
|
1273
|
+
return void 0;
|
|
1274
|
+
}
|
|
1248
1275
|
/**
|
|
1249
1276
|
* Collect tool transforms for a specific tool
|
|
1250
1277
|
* @private
|
|
@@ -1265,8 +1292,9 @@ ${opDescription}`;
|
|
|
1265
1292
|
result.examples = [...opts.global.examples];
|
|
1266
1293
|
}
|
|
1267
1294
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1295
|
+
const perToolMatch = this.resolvePerTool(opts.perTool, tool2);
|
|
1296
|
+
if (perToolMatch) {
|
|
1297
|
+
const perTool = perToolMatch;
|
|
1270
1298
|
if (perTool.name) result.name = perTool.name;
|
|
1271
1299
|
if (perTool.description) result.description = perTool.description;
|
|
1272
1300
|
if (perTool.hideFromDiscovery !== void 0) result.hideFromDiscovery = perTool.hideFromDiscovery;
|
|
@@ -1343,8 +1371,9 @@ ${opDescription}`;
|
|
|
1343
1371
|
if (opts.global) {
|
|
1344
1372
|
transforms.push(...opts.global);
|
|
1345
1373
|
}
|
|
1346
|
-
|
|
1347
|
-
|
|
1374
|
+
const perToolInputTransforms = this.resolvePerTool(opts.perTool, tool2);
|
|
1375
|
+
if (perToolInputTransforms) {
|
|
1376
|
+
transforms.push(...perToolInputTransforms);
|
|
1348
1377
|
}
|
|
1349
1378
|
if (opts.generator) {
|
|
1350
1379
|
transforms.push(...opts.generator(tool2));
|
|
@@ -1491,8 +1520,9 @@ ${opDescription}`;
|
|
|
1491
1520
|
const generated = opts.generator(tool2);
|
|
1492
1521
|
if (generated) return generated;
|
|
1493
1522
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1523
|
+
const perToolInputSchema = this.resolvePerTool(opts.perTool, tool2);
|
|
1524
|
+
if (perToolInputSchema) {
|
|
1525
|
+
return perToolInputSchema;
|
|
1496
1526
|
}
|
|
1497
1527
|
return opts.global;
|
|
1498
1528
|
}
|
|
@@ -1507,8 +1537,9 @@ ${opDescription}`;
|
|
|
1507
1537
|
const generated = opts.generator(tool2);
|
|
1508
1538
|
if (generated) return generated;
|
|
1509
1539
|
}
|
|
1510
|
-
|
|
1511
|
-
|
|
1540
|
+
const perToolOutputSchema = this.resolvePerTool(opts.perTool, tool2);
|
|
1541
|
+
if (perToolOutputSchema) {
|
|
1542
|
+
return perToolOutputSchema;
|
|
1512
1543
|
}
|
|
1513
1544
|
return opts.global;
|
|
1514
1545
|
}
|
|
@@ -1610,8 +1641,9 @@ ${this.formatSchemaAsSummary(schema)}`;
|
|
|
1610
1641
|
if (opts.global) {
|
|
1611
1642
|
result = { ...opts.global };
|
|
1612
1643
|
}
|
|
1613
|
-
|
|
1614
|
-
|
|
1644
|
+
const perToolPre = this.resolvePerTool(opts.perTool, tool2);
|
|
1645
|
+
if (perToolPre) {
|
|
1646
|
+
result = { ...result, ...perToolPre };
|
|
1615
1647
|
}
|
|
1616
1648
|
if (opts.generator) {
|
|
1617
1649
|
const generated = opts.generator(tool2);
|
|
@@ -1632,12 +1664,12 @@ ${this.formatSchemaAsSummary(schema)}`;
|
|
|
1632
1664
|
if (opts.global) {
|
|
1633
1665
|
result = { ...opts.global };
|
|
1634
1666
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1667
|
+
const perToolPost = this.resolvePerTool(opts.perTool, tool2);
|
|
1668
|
+
if (perToolPost) {
|
|
1637
1669
|
result = result ? {
|
|
1638
|
-
transform:
|
|
1639
|
-
filter:
|
|
1640
|
-
} :
|
|
1670
|
+
transform: perToolPost.transform,
|
|
1671
|
+
filter: perToolPost.filter ?? result.filter
|
|
1672
|
+
} : perToolPost;
|
|
1641
1673
|
}
|
|
1642
1674
|
if (opts.generator) {
|
|
1643
1675
|
const generated = opts.generator(tool2);
|
package/openapi/index.js
CHANGED
|
@@ -1163,6 +1163,24 @@ Add one of the following to your adapter configuration:
|
|
|
1163
1163
|
if (this.options.toolTransforms) {
|
|
1164
1164
|
transformedTools = transformedTools.map((tool2) => this.applyToolTransforms(tool2));
|
|
1165
1165
|
}
|
|
1166
|
+
const nameMap = /* @__PURE__ */ new Map();
|
|
1167
|
+
for (const tool2 of transformedTools) {
|
|
1168
|
+
const meta = tool2.metadata;
|
|
1169
|
+
const source = `${meta["method"]?.toUpperCase() ?? "?"} ${meta["path"] ?? "?"}`;
|
|
1170
|
+
const existing = nameMap.get(tool2.name);
|
|
1171
|
+
if (existing) {
|
|
1172
|
+
existing.push(source);
|
|
1173
|
+
} else {
|
|
1174
|
+
nameMap.set(tool2.name, [source]);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
for (const [name, sources] of nameMap) {
|
|
1178
|
+
if (sources.length > 1) {
|
|
1179
|
+
throw new Error(
|
|
1180
|
+
`Tool name collision: "${name}" produced by ${sources.length} operations: ${sources.join(", ")}. Rename conflicting operations in your OpenAPI spec or use toolTransforms.perTool to assign unique names.`
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1166
1184
|
if (this.options.inputTransforms) {
|
|
1167
1185
|
transformedTools = transformedTools.map((tool2) => this.applyInputTransforms(tool2));
|
|
1168
1186
|
}
|
|
@@ -1245,6 +1263,15 @@ ${opDescription}`;
|
|
|
1245
1263
|
description
|
|
1246
1264
|
};
|
|
1247
1265
|
}
|
|
1266
|
+
/**
|
|
1267
|
+
* Look up a value in a perTool map by tool name, using own-property check.
|
|
1268
|
+
* @private
|
|
1269
|
+
*/
|
|
1270
|
+
resolvePerTool(perTool, tool2) {
|
|
1271
|
+
if (!perTool) return void 0;
|
|
1272
|
+
if (Object.prototype.hasOwnProperty.call(perTool, tool2.name)) return perTool[tool2.name];
|
|
1273
|
+
return void 0;
|
|
1274
|
+
}
|
|
1248
1275
|
/**
|
|
1249
1276
|
* Collect tool transforms for a specific tool
|
|
1250
1277
|
* @private
|
|
@@ -1265,8 +1292,9 @@ ${opDescription}`;
|
|
|
1265
1292
|
result.examples = [...opts.global.examples];
|
|
1266
1293
|
}
|
|
1267
1294
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1295
|
+
const perToolMatch = this.resolvePerTool(opts.perTool, tool2);
|
|
1296
|
+
if (perToolMatch) {
|
|
1297
|
+
const perTool = perToolMatch;
|
|
1270
1298
|
if (perTool.name) result.name = perTool.name;
|
|
1271
1299
|
if (perTool.description) result.description = perTool.description;
|
|
1272
1300
|
if (perTool.hideFromDiscovery !== void 0) result.hideFromDiscovery = perTool.hideFromDiscovery;
|
|
@@ -1343,8 +1371,9 @@ ${opDescription}`;
|
|
|
1343
1371
|
if (opts.global) {
|
|
1344
1372
|
transforms.push(...opts.global);
|
|
1345
1373
|
}
|
|
1346
|
-
|
|
1347
|
-
|
|
1374
|
+
const perToolInputTransforms = this.resolvePerTool(opts.perTool, tool2);
|
|
1375
|
+
if (perToolInputTransforms) {
|
|
1376
|
+
transforms.push(...perToolInputTransforms);
|
|
1348
1377
|
}
|
|
1349
1378
|
if (opts.generator) {
|
|
1350
1379
|
transforms.push(...opts.generator(tool2));
|
|
@@ -1491,8 +1520,9 @@ ${opDescription}`;
|
|
|
1491
1520
|
const generated = opts.generator(tool2);
|
|
1492
1521
|
if (generated) return generated;
|
|
1493
1522
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1523
|
+
const perToolInputSchema = this.resolvePerTool(opts.perTool, tool2);
|
|
1524
|
+
if (perToolInputSchema) {
|
|
1525
|
+
return perToolInputSchema;
|
|
1496
1526
|
}
|
|
1497
1527
|
return opts.global;
|
|
1498
1528
|
}
|
|
@@ -1507,8 +1537,9 @@ ${opDescription}`;
|
|
|
1507
1537
|
const generated = opts.generator(tool2);
|
|
1508
1538
|
if (generated) return generated;
|
|
1509
1539
|
}
|
|
1510
|
-
|
|
1511
|
-
|
|
1540
|
+
const perToolOutputSchema = this.resolvePerTool(opts.perTool, tool2);
|
|
1541
|
+
if (perToolOutputSchema) {
|
|
1542
|
+
return perToolOutputSchema;
|
|
1512
1543
|
}
|
|
1513
1544
|
return opts.global;
|
|
1514
1545
|
}
|
|
@@ -1610,8 +1641,9 @@ ${this.formatSchemaAsSummary(schema)}`;
|
|
|
1610
1641
|
if (opts.global) {
|
|
1611
1642
|
result = { ...opts.global };
|
|
1612
1643
|
}
|
|
1613
|
-
|
|
1614
|
-
|
|
1644
|
+
const perToolPre = this.resolvePerTool(opts.perTool, tool2);
|
|
1645
|
+
if (perToolPre) {
|
|
1646
|
+
result = { ...result, ...perToolPre };
|
|
1615
1647
|
}
|
|
1616
1648
|
if (opts.generator) {
|
|
1617
1649
|
const generated = opts.generator(tool2);
|
|
@@ -1632,12 +1664,12 @@ ${this.formatSchemaAsSummary(schema)}`;
|
|
|
1632
1664
|
if (opts.global) {
|
|
1633
1665
|
result = { ...opts.global };
|
|
1634
1666
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1667
|
+
const perToolPost = this.resolvePerTool(opts.perTool, tool2);
|
|
1668
|
+
if (perToolPost) {
|
|
1637
1669
|
result = result ? {
|
|
1638
|
-
transform:
|
|
1639
|
-
filter:
|
|
1640
|
-
} :
|
|
1670
|
+
transform: perToolPost.transform,
|
|
1671
|
+
filter: perToolPost.filter ?? result.filter
|
|
1672
|
+
} : perToolPost;
|
|
1641
1673
|
}
|
|
1642
1674
|
if (opts.generator) {
|
|
1643
1675
|
const generated = opts.generator(tool2);
|
|
@@ -23,6 +23,11 @@ export default class OpenapiAdapter extends DynamicAdapter<OpenApiAdapterOptions
|
|
|
23
23
|
* @private
|
|
24
24
|
*/
|
|
25
25
|
private applyDescriptionMode;
|
|
26
|
+
/**
|
|
27
|
+
* Look up a value in a perTool map by tool name, using own-property check.
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
private resolvePerTool;
|
|
26
31
|
/**
|
|
27
32
|
* Collect tool transforms for a specific tool
|
|
28
33
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.adapter.d.ts","sourceRoot":"","sources":["../../src/openapi/openapi.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,cAAc,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EACL,qBAAqB,EAWtB,MAAM,iBAAiB,CAAC;AA4BzB,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,cAAc,CAAC,qBAAqB,CAAC;IAC/E,OAAO,CAAC,SAAS,CAAC,CAAuB;IACzC,OAAO,CAAC,MAAM,CAAiB;IACxB,OAAO,EAAE,qBAAqB,CAAC;IACtC,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,eAAe,CAA0D;IACjF,OAAO,CAAC,YAAY,CAAoC;gBAE5C,OAAO,EAAE,qBAAqB;IAc1C;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAIjC,KAAK,IAAI,OAAO,CAAC,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"openapi.adapter.d.ts","sourceRoot":"","sources":["../../src/openapi/openapi.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,cAAc,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EACL,qBAAqB,EAWtB,MAAM,iBAAiB,CAAC;AA4BzB,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,cAAc,CAAC,qBAAqB,CAAC;IAC/E,OAAO,CAAC,SAAS,CAAC,CAAuB;IACzC,OAAO,CAAC,MAAM,CAAiB;IACxB,OAAO,EAAE,qBAAqB,CAAC;IACtC,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,eAAe,CAA0D;IACjF,OAAO,CAAC,YAAY,CAAoC;gBAE5C,OAAO,EAAE,qBAAqB;IAc1C;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAIjC,KAAK,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAqI/C;;;OAGG;YACW,mBAAmB;IAqBjC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA0C5B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAMtB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IA6D7B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAsC3B;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAwBhC;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAoD5B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA2D7B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA0C7B;;;OAGG;IACH,OAAO,CAAC,2BAA2B;IAkBnC;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IAoBpC;;;;OAIG;YACW,wBAAwB;IAiFtC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAgBlC;;;OAGG;IACH,OAAO,CAAC,0CAA0C;IA+BlD;;;OAGG;IACH,OAAO,CAAC,2CAA2C;IAyCnD;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAuB7B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,uBAAuB,KAAK,IAAI,GAAG,MAAM,IAAI;IAO3E;;;;OAIG;IACH,YAAY,IAAI,IAAI;IAsCpB;;OAEG;IACH,WAAW,IAAI,IAAI;CAOpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/adapters",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"description": "Adapters for the FrontMCP framework",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"./esm": null
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
54
|
+
"node": ">=24.0.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@frontmcp/utils": "1.0.0-beta.
|
|
58
|
-
"@frontmcp/sdk": "1.0.0-beta.
|
|
57
|
+
"@frontmcp/utils": "1.0.0-beta.10",
|
|
58
|
+
"@frontmcp/sdk": "1.0.0-beta.10",
|
|
59
59
|
"zod": "^4.0.0",
|
|
60
60
|
"openapi-types": "^12.1.3",
|
|
61
61
|
"mcp-from-openapi": "2.1.2",
|