@atlisp/mcp 1.6.11 → 1.6.12
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/dist/atlisp-mcp.js +18 -58
- package/package.json +1 -1
package/dist/atlisp-mcp.js
CHANGED
|
@@ -1041,9 +1041,7 @@ async function getCadInfo() {
|
|
|
1041
1041
|
await cad.connect();
|
|
1042
1042
|
}
|
|
1043
1043
|
if (!cad.connected) {
|
|
1044
|
-
|
|
1045
|
-
setCache("cad:info", result2);
|
|
1046
|
-
return result2;
|
|
1044
|
+
return { connected: false, platform: null, version: null, busy: false };
|
|
1047
1045
|
}
|
|
1048
1046
|
let busy = false;
|
|
1049
1047
|
try {
|
|
@@ -1068,9 +1066,7 @@ async function getEntities(params = {}) {
|
|
|
1068
1066
|
if (!cad.connected)
|
|
1069
1067
|
await cad.connect();
|
|
1070
1068
|
if (!cad.connected) {
|
|
1071
|
-
|
|
1072
|
-
setCache(cacheKey, result);
|
|
1073
|
-
return result;
|
|
1069
|
+
return { total: 0, entities: [] };
|
|
1074
1070
|
}
|
|
1075
1071
|
const hasFilter = params.type || params.layer || params.bbox;
|
|
1076
1072
|
if (!hasFilter) {
|
|
@@ -1084,9 +1080,7 @@ async function getEntities(params = {}) {
|
|
|
1084
1080
|
});
|
|
1085
1081
|
const resultStr = await cad.sendCommandWithResult(code);
|
|
1086
1082
|
if (!resultStr || resultStr === "" || resultStr === "nil") {
|
|
1087
|
-
|
|
1088
|
-
setCache(cacheKey, result2);
|
|
1089
|
-
return result2;
|
|
1083
|
+
return { total: 0, entities: [] };
|
|
1090
1084
|
}
|
|
1091
1085
|
let total = 0;
|
|
1092
1086
|
let entities = [];
|
|
@@ -1102,9 +1096,7 @@ async function getEntities(params = {}) {
|
|
|
1102
1096
|
return result;
|
|
1103
1097
|
} catch (e) {
|
|
1104
1098
|
log(`getEntities error: ${e.message}`);
|
|
1105
|
-
|
|
1106
|
-
setCache(cacheKey, result);
|
|
1107
|
-
return result;
|
|
1099
|
+
return { total: 0, entities: [] };
|
|
1108
1100
|
}
|
|
1109
1101
|
}
|
|
1110
1102
|
async function getEntitiesSummary(cacheKey) {
|
|
@@ -1130,15 +1122,11 @@ async function getEntitiesSummary(cacheKey) {
|
|
|
1130
1122
|
try {
|
|
1131
1123
|
const resultStr = await cad.sendCommandWithResult(summaryCode);
|
|
1132
1124
|
if (!resultStr || resultStr === "" || resultStr === "nil") {
|
|
1133
|
-
|
|
1134
|
-
setCache(cacheKey, result2);
|
|
1135
|
-
return result2;
|
|
1125
|
+
return { total: 0, summary: [] };
|
|
1136
1126
|
}
|
|
1137
1127
|
const parsed = parseLispRecursive(resultStr);
|
|
1138
1128
|
if (!parsed || !Array.isArray(parsed)) {
|
|
1139
|
-
|
|
1140
|
-
setCache(cacheKey, result2);
|
|
1141
|
-
return result2;
|
|
1129
|
+
return { total: 0, summary: [] };
|
|
1142
1130
|
}
|
|
1143
1131
|
let total = 0;
|
|
1144
1132
|
const summary = [];
|
|
@@ -1160,9 +1148,7 @@ async function getEntitiesSummary(cacheKey) {
|
|
|
1160
1148
|
return result;
|
|
1161
1149
|
} catch (e) {
|
|
1162
1150
|
log(`getEntitiesSummary error: ${e.message}`);
|
|
1163
|
-
|
|
1164
|
-
setCache(cacheKey, result);
|
|
1165
|
-
return result;
|
|
1151
|
+
return { total: 0, summary: [] };
|
|
1166
1152
|
}
|
|
1167
1153
|
}
|
|
1168
1154
|
function buildTextContentCode({ layer, bbox, offset, limit }) {
|
|
@@ -1202,9 +1188,7 @@ async function getTextContent(params = {}) {
|
|
|
1202
1188
|
if (!cad.connected)
|
|
1203
1189
|
await cad.connect();
|
|
1204
1190
|
if (!cad.connected) {
|
|
1205
|
-
|
|
1206
|
-
setCache(cacheKey, result);
|
|
1207
|
-
return result;
|
|
1191
|
+
return { total: 0, offset: 0, limit: 5e3, texts: [] };
|
|
1208
1192
|
}
|
|
1209
1193
|
const offset = Math.max(0, parseInt(params.offset) || 0);
|
|
1210
1194
|
const limit = Math.min(Math.max(1, parseInt(params.limit) || 5e3), 5e3);
|
|
@@ -1212,15 +1196,11 @@ async function getTextContent(params = {}) {
|
|
|
1212
1196
|
const code = buildTextContentCode({ layer: params.layer, bbox: params.bbox, offset, limit });
|
|
1213
1197
|
const resultStr = await cad.sendCommandWithResult(code);
|
|
1214
1198
|
if (!resultStr || resultStr === "" || resultStr === "nil" || resultStr === "0") {
|
|
1215
|
-
|
|
1216
|
-
setCache(cacheKey, result);
|
|
1217
|
-
return result;
|
|
1199
|
+
return { total: 0, offset, limit, texts: [] };
|
|
1218
1200
|
}
|
|
1219
1201
|
const parsed = parseLispRecursive(resultStr);
|
|
1220
1202
|
if (!parsed || !Array.isArray(parsed)) {
|
|
1221
|
-
|
|
1222
|
-
setCache(cacheKey, result);
|
|
1223
|
-
return result;
|
|
1203
|
+
return { total: 0, offset, limit, texts: [] };
|
|
1224
1204
|
}
|
|
1225
1205
|
const data = lispPairsToObject(parsed);
|
|
1226
1206
|
const rawTexts = Array.isArray(data.texts) ? data.texts : [];
|
|
@@ -1243,9 +1223,7 @@ async function getTextContent(params = {}) {
|
|
|
1243
1223
|
return data;
|
|
1244
1224
|
} catch (e) {
|
|
1245
1225
|
log(`getTextContent error: ${e.message}`);
|
|
1246
|
-
|
|
1247
|
-
setCache(cacheKey, result);
|
|
1248
|
-
return result;
|
|
1226
|
+
return { total: 0, offset, limit, texts: [] };
|
|
1249
1227
|
}
|
|
1250
1228
|
}
|
|
1251
1229
|
async function getDwgName() {
|
|
@@ -1376,23 +1354,17 @@ async function getBlockRefs(params = {}) {
|
|
|
1376
1354
|
if (!cad.connected)
|
|
1377
1355
|
await cad.connect();
|
|
1378
1356
|
if (!cad.connected) {
|
|
1379
|
-
|
|
1380
|
-
setCache(cacheKey, result);
|
|
1381
|
-
return result;
|
|
1357
|
+
return { total: 0, blockRefs: [] };
|
|
1382
1358
|
}
|
|
1383
1359
|
try {
|
|
1384
1360
|
const code = buildBlockRefsCode(params.blockName);
|
|
1385
1361
|
const resultStr = await cad.sendCommandWithResult(code);
|
|
1386
1362
|
if (!resultStr || resultStr === "" || resultStr === "nil") {
|
|
1387
|
-
|
|
1388
|
-
setCache(cacheKey, result2);
|
|
1389
|
-
return result2;
|
|
1363
|
+
return { total: 0, blockRefs: [] };
|
|
1390
1364
|
}
|
|
1391
1365
|
const parsed = parseLispRecursive(resultStr);
|
|
1392
1366
|
if (!parsed || !Array.isArray(parsed)) {
|
|
1393
|
-
|
|
1394
|
-
setCache(cacheKey, result2);
|
|
1395
|
-
return result2;
|
|
1367
|
+
return { total: 0, blockRefs: [] };
|
|
1396
1368
|
}
|
|
1397
1369
|
const result = lispPairsToObject(parsed);
|
|
1398
1370
|
const blockRefs = Array.isArray(result.blockRefs) ? result.blockRefs : [];
|
|
@@ -1423,9 +1395,7 @@ async function getBlockRefs(params = {}) {
|
|
|
1423
1395
|
return finalResult;
|
|
1424
1396
|
} catch (e) {
|
|
1425
1397
|
log(`getBlockRefs error: ${e.message}`);
|
|
1426
|
-
|
|
1427
|
-
setCache(cacheKey, result);
|
|
1428
|
-
return result;
|
|
1398
|
+
return { total: 0, blockRefs: [] };
|
|
1429
1399
|
}
|
|
1430
1400
|
}
|
|
1431
1401
|
var TBL_QUERIES = {
|
|
@@ -1538,15 +1508,11 @@ async function getTables(params = {}) {
|
|
|
1538
1508
|
const code = buildTablesCode(tblName);
|
|
1539
1509
|
const resultStr = await cad.sendCommandWithResult(code);
|
|
1540
1510
|
if (!resultStr || resultStr === "" || resultStr === "nil") {
|
|
1541
|
-
|
|
1542
|
-
setCache(cacheKey, result2);
|
|
1543
|
-
return result2;
|
|
1511
|
+
return { table: tblName, data: [] };
|
|
1544
1512
|
}
|
|
1545
1513
|
const parsed = parseLispRecursive(resultStr);
|
|
1546
1514
|
if (!parsed || !Array.isArray(parsed)) {
|
|
1547
|
-
|
|
1548
|
-
setCache(cacheKey, result2);
|
|
1549
|
-
return result2;
|
|
1515
|
+
return { table: tblName, total: 0, data: [] };
|
|
1550
1516
|
}
|
|
1551
1517
|
let result;
|
|
1552
1518
|
if (parsed.length >= 3 && parsed[0] && String(parsed[0][0]).toUpperCase() === "TABLE") {
|
|
@@ -1618,9 +1584,7 @@ async function getTables(params = {}) {
|
|
|
1618
1584
|
return result;
|
|
1619
1585
|
} catch (e) {
|
|
1620
1586
|
log(`getTables error: ${e.message}`);
|
|
1621
|
-
|
|
1622
|
-
setCache(cacheKey, result);
|
|
1623
|
-
return result;
|
|
1587
|
+
return { table: tblName, data: [] };
|
|
1624
1588
|
}
|
|
1625
1589
|
}
|
|
1626
1590
|
async function getPackages(filterName = null) {
|
|
@@ -1636,7 +1600,6 @@ async function getPackages(filterName = null) {
|
|
|
1636
1600
|
const code = `(mapcar 'cdr @::*local-pkgs*)`;
|
|
1637
1601
|
const result = await cad.sendCommandWithResult(code);
|
|
1638
1602
|
if (!result || result === "" || result === "nil") {
|
|
1639
|
-
setCache(cacheKey, []);
|
|
1640
1603
|
return [];
|
|
1641
1604
|
}
|
|
1642
1605
|
let raw = [];
|
|
@@ -1707,7 +1670,6 @@ async function getPackages(filterName = null) {
|
|
|
1707
1670
|
setCache(cacheKey, packages);
|
|
1708
1671
|
return packages;
|
|
1709
1672
|
} catch (e) {
|
|
1710
|
-
setCache(cacheKey, []);
|
|
1711
1673
|
return [];
|
|
1712
1674
|
}
|
|
1713
1675
|
}
|
|
@@ -1737,7 +1699,6 @@ async function getDwgList() {
|
|
|
1737
1699
|
)`;
|
|
1738
1700
|
const result = await cad.sendCommandWithResult(code);
|
|
1739
1701
|
if (!result || result === "" || result === "nil") {
|
|
1740
|
-
setCache(cacheKey, []);
|
|
1741
1702
|
return [];
|
|
1742
1703
|
}
|
|
1743
1704
|
let parsed = [];
|
|
@@ -1760,7 +1721,6 @@ async function getDwgList() {
|
|
|
1760
1721
|
setCache(cacheKey, dwgList);
|
|
1761
1722
|
return dwgList;
|
|
1762
1723
|
} catch (e) {
|
|
1763
|
-
setCache(cacheKey, []);
|
|
1764
1724
|
return [];
|
|
1765
1725
|
}
|
|
1766
1726
|
}
|