@ifc-lite/mcp 0.2.0
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/LICENSE +373 -0
- package/README.md +186 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +5 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/scope.d.ts +24 -0
- package/dist/auth/scope.d.ts.map +1 -0
- package/dist/auth/scope.js +26 -0
- package/dist/auth/scope.js.map +1 -0
- package/dist/browser.d.ts +37 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +37 -0
- package/dist/browser.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +233 -0
- package/dist/cli.js.map +1 -0
- package/dist/context.d.ts +87 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +41 -0
- package/dist/context.js.map +1 -0
- package/dist/errors.d.ts +37 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +49 -0
- package/dist/errors.js.map +1 -0
- package/dist/headless-backend.d.ts +61 -0
- package/dist/headless-backend.d.ts.map +1 -0
- package/dist/headless-backend.js +472 -0
- package/dist/headless-backend.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/loader.d.ts +9 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +76 -0
- package/dist/loader.js.map +1 -0
- package/dist/prompts/index.d.ts +6 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +13 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/templates.d.ts +21 -0
- package/dist/prompts/templates.d.ts.map +1 -0
- package/dist/prompts/templates.js +238 -0
- package/dist/prompts/templates.js.map +1 -0
- package/dist/prompts/types.d.ts +17 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/types.js +27 -0
- package/dist/prompts/types.js.map +1 -0
- package/dist/protocol/index.d.ts +3 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +6 -0
- package/dist/protocol/index.js.map +1 -0
- package/dist/protocol/jsonrpc.d.ts +12 -0
- package/dist/protocol/jsonrpc.d.ts.map +1 -0
- package/dist/protocol/jsonrpc.js +62 -0
- package/dist/protocol/jsonrpc.js.map +1 -0
- package/dist/protocol/types.d.ts +223 -0
- package/dist/protocol/types.d.ts.map +1 -0
- package/dist/protocol/types.js +37 -0
- package/dist/protocol/types.js.map +1 -0
- package/dist/resources/index.d.ts +6 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +13 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/providers.d.ts +3 -0
- package/dist/resources/providers.d.ts.map +1 -0
- package/dist/resources/providers.js +270 -0
- package/dist/resources/providers.js.map +1 -0
- package/dist/resources/types.d.ts +29 -0
- package/dist/resources/types.d.ts.map +1 -0
- package/dist/resources/types.js +30 -0
- package/dist/resources/types.js.map +1 -0
- package/dist/server.d.ts +93 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +396 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/bcf.d.ts +3 -0
- package/dist/tools/bcf.d.ts.map +1 -0
- package/dist/tools/bcf.js +208 -0
- package/dist/tools/bcf.js.map +1 -0
- package/dist/tools/bsdd.d.ts +3 -0
- package/dist/tools/bsdd.d.ts.map +1 -0
- package/dist/tools/bsdd.js +267 -0
- package/dist/tools/bsdd.js.map +1 -0
- package/dist/tools/diff.d.ts +3 -0
- package/dist/tools/diff.d.ts.map +1 -0
- package/dist/tools/diff.js +149 -0
- package/dist/tools/diff.js.map +1 -0
- package/dist/tools/discovery.d.ts +8 -0
- package/dist/tools/discovery.d.ts.map +1 -0
- package/dist/tools/discovery.js +181 -0
- package/dist/tools/discovery.js.map +1 -0
- package/dist/tools/export.d.ts +3 -0
- package/dist/tools/export.d.ts.map +1 -0
- package/dist/tools/export.js +157 -0
- package/dist/tools/export.js.map +1 -0
- package/dist/tools/geometry.d.ts +3 -0
- package/dist/tools/geometry.d.ts.map +1 -0
- package/dist/tools/geometry.js +252 -0
- package/dist/tools/geometry.js.map +1 -0
- package/dist/tools/ids-accessor.d.ts +9 -0
- package/dist/tools/ids-accessor.d.ts.map +1 -0
- package/dist/tools/ids-accessor.js +131 -0
- package/dist/tools/ids-accessor.js.map +1 -0
- package/dist/tools/index.d.ts +21 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +36 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/mutate.d.ts +3 -0
- package/dist/tools/mutate.d.ts.map +1 -0
- package/dist/tools/mutate.js +350 -0
- package/dist/tools/mutate.js.map +1 -0
- package/dist/tools/query.d.ts +3 -0
- package/dist/tools/query.d.ts.map +1 -0
- package/dist/tools/query.js +549 -0
- package/dist/tools/query.js.map +1 -0
- package/dist/tools/types.d.ts +18 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +26 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/util.d.ts +19 -0
- package/dist/tools/util.d.ts.map +1 -0
- package/dist/tools/util.js +53 -0
- package/dist/tools/util.js.map +1 -0
- package/dist/tools/validation.d.ts +3 -0
- package/dist/tools/validation.d.ts.map +1 -0
- package/dist/tools/validation.js +244 -0
- package/dist/tools/validation.js.map +1 -0
- package/dist/tools/viewer.d.ts +3 -0
- package/dist/tools/viewer.d.ts.map +1 -0
- package/dist/tools/viewer.js +651 -0
- package/dist/tools/viewer.js.map +1 -0
- package/dist/transport/http.d.ts +64 -0
- package/dist/transport/http.d.ts.map +1 -0
- package/dist/transport/http.js +268 -0
- package/dist/transport/http.js.map +1 -0
- package/dist/transport/in-process.d.ts +25 -0
- package/dist/transport/in-process.d.ts.map +1 -0
- package/dist/transport/in-process.js +48 -0
- package/dist/transport/in-process.js.map +1 -0
- package/dist/transport/stdio.d.ts +33 -0
- package/dist/transport/stdio.d.ts.map +1 -0
- package/dist/transport/stdio.js +86 -0
- package/dist/transport/stdio.js.map +1 -0
- package/dist/validate.d.ts +23 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +88 -0
- package/dist/validate.js.map +1 -0
- package/dist/viewer-manager.d.ts +51 -0
- package/dist/viewer-manager.d.ts.map +1 -0
- package/dist/viewer-manager.js +183 -0
- package/dist/viewer-manager.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Geometry tools (spec §7.3).
|
|
6
|
+
*
|
|
7
|
+
* v0.1 strategy: serve the cheap, accurate values that come straight off
|
|
8
|
+
* IfcElementQuantity (volume, area), and surface a UNSUPPORTED_OPERATION
|
|
9
|
+
* with a useful hint for tools that need WASM-driven mesh tessellation
|
|
10
|
+
* (geometry_get, raycast, clash_check). When `@ifc-lite/wasm` lands in the
|
|
11
|
+
* MCP container we wire it in here without changing the tool surface.
|
|
12
|
+
*/
|
|
13
|
+
import { EntityNode } from '@ifc-lite/query';
|
|
14
|
+
import { okResult, resolveModel } from './util.js';
|
|
15
|
+
import { ToolErrorCode, ToolExecutionError } from '../errors.js';
|
|
16
|
+
function resolveExpressIds(m, input) {
|
|
17
|
+
const ids = [];
|
|
18
|
+
if (Array.isArray(input.express_ids))
|
|
19
|
+
ids.push(...input.express_ids);
|
|
20
|
+
if (typeof input.express_id === 'number')
|
|
21
|
+
ids.push(input.express_id);
|
|
22
|
+
if (typeof input.global_id === 'string') {
|
|
23
|
+
const gid = input.global_id;
|
|
24
|
+
for (const [, list] of m.store.entityIndex.byType) {
|
|
25
|
+
for (const id of list) {
|
|
26
|
+
const node = new EntityNode(m.store, id);
|
|
27
|
+
if (node.globalId === gid)
|
|
28
|
+
ids.push(id);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (Array.isArray(input.global_ids)) {
|
|
33
|
+
const set = new Set(input.global_ids);
|
|
34
|
+
for (const [, list] of m.store.entityIndex.byType) {
|
|
35
|
+
for (const id of list) {
|
|
36
|
+
const node = new EntityNode(m.store, id);
|
|
37
|
+
if (set.has(node.globalId))
|
|
38
|
+
ids.push(id);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return ids;
|
|
43
|
+
}
|
|
44
|
+
const geometryGet = {
|
|
45
|
+
name: 'geometry_get',
|
|
46
|
+
description: 'Mesh data (positions, indices, normals) for an entity selection. Requires the WASM geometry pipeline; returns UNSUPPORTED_OPERATION when the server runs without it.',
|
|
47
|
+
scope: 'read',
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: {
|
|
51
|
+
model_id: { type: 'string' },
|
|
52
|
+
global_id: { type: 'string' },
|
|
53
|
+
express_id: { type: 'integer' },
|
|
54
|
+
global_ids: { type: 'array', items: { type: 'string' } },
|
|
55
|
+
express_ids: { type: 'array', items: { type: 'integer' } },
|
|
56
|
+
format: { type: 'string', enum: ['json', 'gltf'], default: 'json' },
|
|
57
|
+
},
|
|
58
|
+
additionalProperties: false,
|
|
59
|
+
},
|
|
60
|
+
handler() {
|
|
61
|
+
// The geometry tessellation pipeline lives in @ifc-lite/wasm and is
|
|
62
|
+
// browser-shaped today. v0.1 surfaces a clear refusal so agents can
|
|
63
|
+
// pick a different path (geometry_bbox / geometry_volume).
|
|
64
|
+
throw new ToolExecutionError({
|
|
65
|
+
code: ToolErrorCode.UNSUPPORTED_OPERATION,
|
|
66
|
+
message: 'geometry_get requires the WASM geometry pipeline, which is not loaded in this MCP build.',
|
|
67
|
+
hint: 'Use geometry_bbox / geometry_volume / geometry_area for quantity-based answers, or run the server with the geometry profile (planned for v0.2).',
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
const geometryBbox = {
|
|
72
|
+
name: 'geometry_bbox',
|
|
73
|
+
description: 'Axis-aligned bounding box for one or many entities, computed from IfcElementQuantity values when available.',
|
|
74
|
+
scope: 'read',
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
properties: {
|
|
78
|
+
model_id: { type: 'string' },
|
|
79
|
+
global_id: { type: 'string' },
|
|
80
|
+
express_id: { type: 'integer' },
|
|
81
|
+
global_ids: { type: 'array', items: { type: 'string' } },
|
|
82
|
+
express_ids: { type: 'array', items: { type: 'integer' } },
|
|
83
|
+
},
|
|
84
|
+
additionalProperties: false,
|
|
85
|
+
},
|
|
86
|
+
handler(input, ctx) {
|
|
87
|
+
const m = resolveModel(ctx, input.model_id);
|
|
88
|
+
const ids = resolveExpressIds(m, input);
|
|
89
|
+
if (ids.length === 0) {
|
|
90
|
+
throw new ToolExecutionError({ code: ToolErrorCode.INVALID_INPUT, message: 'Provide an entity selector.' });
|
|
91
|
+
}
|
|
92
|
+
const boxes = [];
|
|
93
|
+
for (const id of ids) {
|
|
94
|
+
const node = new EntityNode(m.store, id);
|
|
95
|
+
const qsets = node.quantities();
|
|
96
|
+
let length;
|
|
97
|
+
let width;
|
|
98
|
+
let height;
|
|
99
|
+
for (const qset of qsets) {
|
|
100
|
+
for (const q of qset.quantities) {
|
|
101
|
+
if (q.name === 'Length' || q.name === 'GrossLength')
|
|
102
|
+
length = q.value;
|
|
103
|
+
else if (q.name === 'Width' || q.name === 'GrossWidth')
|
|
104
|
+
width = q.value;
|
|
105
|
+
else if (q.name === 'Height' || q.name === 'GrossHeight')
|
|
106
|
+
height = q.value;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const bbox = (length || width || height)
|
|
110
|
+
? { length: length ?? null, width: width ?? null, height: height ?? null }
|
|
111
|
+
: null;
|
|
112
|
+
boxes.push({ expressId: id, bbox: bbox });
|
|
113
|
+
}
|
|
114
|
+
const withData = boxes.filter((b) => b.bbox).length;
|
|
115
|
+
return okResult(`Read ${withData}/${boxes.length} bounding boxes from quantity sets.`, { boxes, missing: boxes.length - withData });
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
const geometryVolume = {
|
|
119
|
+
name: 'geometry_volume',
|
|
120
|
+
description: 'Element volume (m³) read from IfcElementQuantity. Returns null per entity when no quantity is present.',
|
|
121
|
+
scope: 'read',
|
|
122
|
+
inputSchema: {
|
|
123
|
+
type: 'object',
|
|
124
|
+
properties: {
|
|
125
|
+
model_id: { type: 'string' },
|
|
126
|
+
global_id: { type: 'string' },
|
|
127
|
+
express_id: { type: 'integer' },
|
|
128
|
+
global_ids: { type: 'array', items: { type: 'string' } },
|
|
129
|
+
express_ids: { type: 'array', items: { type: 'integer' } },
|
|
130
|
+
},
|
|
131
|
+
additionalProperties: false,
|
|
132
|
+
},
|
|
133
|
+
handler(input, ctx) {
|
|
134
|
+
const m = resolveModel(ctx, input.model_id);
|
|
135
|
+
const ids = resolveExpressIds(m, input);
|
|
136
|
+
const results = [];
|
|
137
|
+
let total = 0;
|
|
138
|
+
let counted = 0;
|
|
139
|
+
for (const id of ids) {
|
|
140
|
+
const node = new EntityNode(m.store, id);
|
|
141
|
+
const qsets = node.quantities();
|
|
142
|
+
let volume = null;
|
|
143
|
+
outer: for (const qset of qsets) {
|
|
144
|
+
for (const q of qset.quantities) {
|
|
145
|
+
if (/Volume$/i.test(q.name)) {
|
|
146
|
+
volume = q.value;
|
|
147
|
+
break outer;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (volume != null) {
|
|
152
|
+
total += volume;
|
|
153
|
+
counted++;
|
|
154
|
+
}
|
|
155
|
+
results.push({ expressId: id, volume });
|
|
156
|
+
}
|
|
157
|
+
return okResult(`${counted}/${results.length} entities reported a volume; total = ${total.toFixed(3)} m³.`, { total, counted, results });
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
const geometryArea = {
|
|
161
|
+
name: 'geometry_area',
|
|
162
|
+
description: 'Element surface area (m²) read from IfcElementQuantity.',
|
|
163
|
+
scope: 'read',
|
|
164
|
+
inputSchema: {
|
|
165
|
+
type: 'object',
|
|
166
|
+
properties: {
|
|
167
|
+
model_id: { type: 'string' },
|
|
168
|
+
global_id: { type: 'string' },
|
|
169
|
+
express_id: { type: 'integer' },
|
|
170
|
+
global_ids: { type: 'array', items: { type: 'string' } },
|
|
171
|
+
express_ids: { type: 'array', items: { type: 'integer' } },
|
|
172
|
+
},
|
|
173
|
+
additionalProperties: false,
|
|
174
|
+
},
|
|
175
|
+
handler(input, ctx) {
|
|
176
|
+
const m = resolveModel(ctx, input.model_id);
|
|
177
|
+
const ids = resolveExpressIds(m, input);
|
|
178
|
+
const results = [];
|
|
179
|
+
let total = 0;
|
|
180
|
+
let counted = 0;
|
|
181
|
+
for (const id of ids) {
|
|
182
|
+
const node = new EntityNode(m.store, id);
|
|
183
|
+
const qsets = node.quantities();
|
|
184
|
+
let area = null;
|
|
185
|
+
outer: for (const qset of qsets) {
|
|
186
|
+
for (const q of qset.quantities) {
|
|
187
|
+
if (/(GrossSideArea|GrossArea|NetArea|Area)$/i.test(q.name)) {
|
|
188
|
+
area = q.value;
|
|
189
|
+
break outer;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (area != null) {
|
|
194
|
+
total += area;
|
|
195
|
+
counted++;
|
|
196
|
+
}
|
|
197
|
+
results.push({ expressId: id, area });
|
|
198
|
+
}
|
|
199
|
+
return okResult(`${counted}/${results.length} entities reported an area; total = ${total.toFixed(3)} m².`, { total, counted, results });
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
const raycast = {
|
|
203
|
+
name: 'raycast',
|
|
204
|
+
description: 'Cast a world-space ray against the model. Requires the WASM geometry pipeline.',
|
|
205
|
+
scope: 'read',
|
|
206
|
+
inputSchema: {
|
|
207
|
+
type: 'object',
|
|
208
|
+
properties: {
|
|
209
|
+
model_id: { type: 'string' },
|
|
210
|
+
origin: { type: 'array', items: { type: 'number' } },
|
|
211
|
+
direction: { type: 'array', items: { type: 'number' } },
|
|
212
|
+
},
|
|
213
|
+
required: ['origin', 'direction'],
|
|
214
|
+
additionalProperties: false,
|
|
215
|
+
},
|
|
216
|
+
handler() {
|
|
217
|
+
throw new ToolExecutionError({
|
|
218
|
+
code: ToolErrorCode.UNSUPPORTED_OPERATION,
|
|
219
|
+
message: 'raycast requires the WASM geometry pipeline (planned for v0.2).',
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
const clashCheck = {
|
|
224
|
+
name: 'clash_check',
|
|
225
|
+
description: 'Pairwise clash detection on element selections. Requires the WASM geometry pipeline.',
|
|
226
|
+
scope: 'read',
|
|
227
|
+
inputSchema: {
|
|
228
|
+
type: 'object',
|
|
229
|
+
properties: {
|
|
230
|
+
model_id: { type: 'string' },
|
|
231
|
+
a: { type: 'array', items: { type: 'string' }, description: 'GlobalIds for set A.' },
|
|
232
|
+
b: { type: 'array', items: { type: 'string' }, description: 'GlobalIds for set B.' },
|
|
233
|
+
},
|
|
234
|
+
required: ['a', 'b'],
|
|
235
|
+
additionalProperties: false,
|
|
236
|
+
},
|
|
237
|
+
handler() {
|
|
238
|
+
throw new ToolExecutionError({
|
|
239
|
+
code: ToolErrorCode.UNSUPPORTED_OPERATION,
|
|
240
|
+
message: 'clash_check requires the WASM geometry pipeline (planned for v0.2).',
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
export const geometryTools = [
|
|
245
|
+
geometryGet,
|
|
246
|
+
geometryBbox,
|
|
247
|
+
geometryVolume,
|
|
248
|
+
geometryArea,
|
|
249
|
+
raycast,
|
|
250
|
+
clashCheck,
|
|
251
|
+
];
|
|
252
|
+
//# sourceMappingURL=geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["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
2
|
+
* Build the data accessor that `@ifc-lite/ids` validators expect. Mirrors the
|
|
3
|
+
* accessor used by `@ifc-lite/cli` so we get identical semantics on both
|
|
4
|
+
* surfaces. Co-locating this in the MCP package avoids a CLI runtime
|
|
5
|
+
* dependency, which would also drag in the viewer-core renderer.
|
|
6
|
+
*/
|
|
7
|
+
import type { IfcDataStore } from '@ifc-lite/parser';
|
|
8
|
+
export declare function buildIdsAccessor(store: IfcDataStore): unknown;
|
|
9
|
+
//# sourceMappingURL=ids-accessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids-accessor.d.ts","sourceRoot":"","sources":["../../src/tools/ids-accessor.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAkBrD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAwG7D"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { extractAllEntityAttributes, extractClassificationsOnDemand, extractMaterialsOnDemand, extractTypeEntityOwnProperties, } from '@ifc-lite/parser';
|
|
5
|
+
import { EntityNode } from '@ifc-lite/query';
|
|
6
|
+
import { RelationshipType } from '@ifc-lite/data';
|
|
7
|
+
const REL_TYPE_MAP = {
|
|
8
|
+
IfcRelAggregates: RelationshipType.Aggregates,
|
|
9
|
+
IfcRelContainedInSpatialStructure: RelationshipType.ContainsElements,
|
|
10
|
+
IfcRelNests: RelationshipType.Aggregates,
|
|
11
|
+
IfcRelVoidsElement: RelationshipType.VoidsElement,
|
|
12
|
+
IfcRelFillsElement: RelationshipType.FillsElement,
|
|
13
|
+
};
|
|
14
|
+
export function buildIdsAccessor(store) {
|
|
15
|
+
return {
|
|
16
|
+
getEntityType(expressId) {
|
|
17
|
+
return store.entities.getTypeName(expressId) || undefined;
|
|
18
|
+
},
|
|
19
|
+
getEntityName(expressId) {
|
|
20
|
+
return new EntityNode(store, expressId).name || undefined;
|
|
21
|
+
},
|
|
22
|
+
getGlobalId(expressId) {
|
|
23
|
+
return new EntityNode(store, expressId).globalId || undefined;
|
|
24
|
+
},
|
|
25
|
+
getDescription(expressId) {
|
|
26
|
+
return new EntityNode(store, expressId).description || undefined;
|
|
27
|
+
},
|
|
28
|
+
getObjectType(expressId) {
|
|
29
|
+
const node = new EntityNode(store, expressId);
|
|
30
|
+
if (node.objectType)
|
|
31
|
+
return node.objectType;
|
|
32
|
+
const allAttrs = extractAllEntityAttributes(store, expressId);
|
|
33
|
+
const predefined = allAttrs.find((a) => a.name === 'PredefinedType');
|
|
34
|
+
if (predefined?.value && predefined.value !== 'NOTDEFINED')
|
|
35
|
+
return predefined.value;
|
|
36
|
+
const objType = allAttrs.find((a) => a.name === 'ObjectType');
|
|
37
|
+
return objType?.value;
|
|
38
|
+
},
|
|
39
|
+
getEntitiesByType(typeName) {
|
|
40
|
+
return [...(store.entityIndex.byType.get(typeName.toUpperCase()) ?? [])];
|
|
41
|
+
},
|
|
42
|
+
getAllEntityIds() {
|
|
43
|
+
const ids = [];
|
|
44
|
+
for (const [, list] of store.entityIndex.byType)
|
|
45
|
+
for (const id of list)
|
|
46
|
+
ids.push(id);
|
|
47
|
+
return ids;
|
|
48
|
+
},
|
|
49
|
+
getPropertyValue(expressId, psetName, propName) {
|
|
50
|
+
const node = new EntityNode(store, expressId);
|
|
51
|
+
for (const pset of node.properties()) {
|
|
52
|
+
if (pset.name !== psetName)
|
|
53
|
+
continue;
|
|
54
|
+
for (const prop of pset.properties) {
|
|
55
|
+
if (prop.name === propName) {
|
|
56
|
+
return { value: prop.value ?? null, dataType: prop.type ?? 'IFCLABEL', propertySetName: pset.name, propertyName: prop.name };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
},
|
|
62
|
+
getPropertySets(expressId) {
|
|
63
|
+
const node = new EntityNode(store, expressId);
|
|
64
|
+
const psets = node.properties();
|
|
65
|
+
const mapPsets = (raw) => raw.map((p) => ({
|
|
66
|
+
name: p.name,
|
|
67
|
+
properties: p.properties.map((pp) => ({ name: pp.name, value: pp.value ?? null, dataType: pp.type ?? 'IFCLABEL' })),
|
|
68
|
+
}));
|
|
69
|
+
if (psets.length > 0)
|
|
70
|
+
return mapPsets(psets);
|
|
71
|
+
const typePsets = extractTypeEntityOwnProperties(store, expressId);
|
|
72
|
+
if (typePsets.length > 0)
|
|
73
|
+
return mapPsets(typePsets);
|
|
74
|
+
return [];
|
|
75
|
+
},
|
|
76
|
+
getClassifications(expressId) {
|
|
77
|
+
return extractClassificationsOnDemand(store, expressId).map((c) => ({
|
|
78
|
+
system: c.system ?? '',
|
|
79
|
+
value: c.identification ?? '',
|
|
80
|
+
name: c.name ?? undefined,
|
|
81
|
+
}));
|
|
82
|
+
},
|
|
83
|
+
getMaterials(expressId) {
|
|
84
|
+
const data = extractMaterialsOnDemand(store, expressId);
|
|
85
|
+
if (!data)
|
|
86
|
+
return [];
|
|
87
|
+
const materials = [];
|
|
88
|
+
if (data.name)
|
|
89
|
+
materials.push({ name: data.name });
|
|
90
|
+
if (data.layers)
|
|
91
|
+
for (const layer of data.layers) {
|
|
92
|
+
if (layer.materialName)
|
|
93
|
+
materials.push({ name: layer.materialName, category: layer.category ?? undefined });
|
|
94
|
+
}
|
|
95
|
+
return materials;
|
|
96
|
+
},
|
|
97
|
+
getParent(expressId, relationType) {
|
|
98
|
+
const relEnum = REL_TYPE_MAP[relationType];
|
|
99
|
+
if (relEnum === undefined)
|
|
100
|
+
return undefined;
|
|
101
|
+
const parents = store.relationships.getRelated(expressId, relEnum, 'inverse');
|
|
102
|
+
if (parents.length === 0)
|
|
103
|
+
return undefined;
|
|
104
|
+
const parentId = parents[0];
|
|
105
|
+
const parentType = store.entities.getTypeName(parentId);
|
|
106
|
+
const attrs = extractAllEntityAttributes(store, parentId);
|
|
107
|
+
const predefined = attrs.find((a) => a.name === 'PredefinedType');
|
|
108
|
+
return {
|
|
109
|
+
expressId: parentId,
|
|
110
|
+
entityType: parentType ?? '',
|
|
111
|
+
predefinedType: predefined?.value && predefined.value !== 'NOTDEFINED' ? predefined.value : undefined,
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
getAttribute(expressId, name) {
|
|
115
|
+
const node = new EntityNode(store, expressId);
|
|
116
|
+
switch (name) {
|
|
117
|
+
case 'Name': return node.name || undefined;
|
|
118
|
+
case 'Description': return node.description || undefined;
|
|
119
|
+
case 'ObjectType': return node.objectType || undefined;
|
|
120
|
+
case 'GlobalId': return node.globalId || undefined;
|
|
121
|
+
case 'Tag': return node.tag || undefined;
|
|
122
|
+
default: {
|
|
123
|
+
const attrs = extractAllEntityAttributes(store, expressId);
|
|
124
|
+
const attr = attrs.find((a) => a.name === name);
|
|
125
|
+
return attr?.value != null ? String(attr.value) : undefined;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=ids-accessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids-accessor.js","sourceRoot":"","sources":["../../src/tools/ids-accessor.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAU/D,OAAO,EACL,0BAA0B,EAC1B,8BAA8B,EAC9B,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,YAAY,GAAqC;IACrD,gBAAgB,EAAE,gBAAgB,CAAC,UAAU;IAC7C,iCAAiC,EAAE,gBAAgB,CAAC,gBAAgB;IACpE,WAAW,EAAE,gBAAgB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AAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;aACtG,CAAC;QACJ,CAAC;QACD,YAAY,CAAC,SAAiB,EAAE,IAAY;YAC1C,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAC9C,QAAQ,IAAI,EAAE,CAAC;gBACb,KAAK,MAAM,CAAC,CAAC,OAAO,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC;gBAC3C,KAAK,aAAa,CAAC,CAAC,OAAO,IAAI,CAAC,WAAW,IAAI,SAAS,CAAC;gBACzD,KAAK,YAAY,CAAC,CAAC,OAAO,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC;gBACvD,KAAK,UAAU,CAAC,CAAC,OAAO,IAAI,CAAC,QAAQ,IAAI,SAAS,CAAC;gBACnD,KAAK,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,GAAG,IAAI,SAAS,CAAC;gBACzC,OAAO,CAAC,CAAC,CAAC;oBACR,MAAM,KAAK,GAAG,0BAA0B,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;oBAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;oBAChD,OAAO,IAAI,EAAE,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBAC9D,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ToolRegistry } from './types.js';
|
|
2
|
+
import { discoveryTools } from './discovery.js';
|
|
3
|
+
import { queryTools } from './query.js';
|
|
4
|
+
import { geometryTools } from './geometry.js';
|
|
5
|
+
import { validationTools } from './validation.js';
|
|
6
|
+
import { mutationTools } from './mutate.js';
|
|
7
|
+
import { bcfTools } from './bcf.js';
|
|
8
|
+
import { bsddTools } from './bsdd.js';
|
|
9
|
+
import { diffTools } from './diff.js';
|
|
10
|
+
import { exportTools } from './export.js';
|
|
11
|
+
import { viewerTools } from './viewer.js';
|
|
12
|
+
export { ToolRegistry } from './types.js';
|
|
13
|
+
export type { Tool } from './types.js';
|
|
14
|
+
export { discoveryTools, queryTools, geometryTools, validationTools, mutationTools, bcfTools, bsddTools, diffTools, exportTools, viewerTools, };
|
|
15
|
+
/**
|
|
16
|
+
* Build a ToolRegistry pre-loaded with every tool ifc-lite-mcp ships in v0.1.
|
|
17
|
+
* Callers can pass through to `MCPServerOptions.tools`, or filter by category
|
|
18
|
+
* for narrower deployments (e.g. read-only public mirror).
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildDefaultToolRegistry(): ToolRegistry;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,eAAe,EACf,aAAa,EACb,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,GACZ,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,YAAY,CAavD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { ToolRegistry } from './types.js';
|
|
5
|
+
import { discoveryTools } from './discovery.js';
|
|
6
|
+
import { queryTools } from './query.js';
|
|
7
|
+
import { geometryTools } from './geometry.js';
|
|
8
|
+
import { validationTools } from './validation.js';
|
|
9
|
+
import { mutationTools } from './mutate.js';
|
|
10
|
+
import { bcfTools } from './bcf.js';
|
|
11
|
+
import { bsddTools } from './bsdd.js';
|
|
12
|
+
import { diffTools } from './diff.js';
|
|
13
|
+
import { exportTools } from './export.js';
|
|
14
|
+
import { viewerTools } from './viewer.js';
|
|
15
|
+
export { ToolRegistry } from './types.js';
|
|
16
|
+
export { discoveryTools, queryTools, geometryTools, validationTools, mutationTools, bcfTools, bsddTools, diffTools, exportTools, viewerTools, };
|
|
17
|
+
/**
|
|
18
|
+
* Build a ToolRegistry pre-loaded with every tool ifc-lite-mcp ships in v0.1.
|
|
19
|
+
* Callers can pass through to `MCPServerOptions.tools`, or filter by category
|
|
20
|
+
* for narrower deployments (e.g. read-only public mirror).
|
|
21
|
+
*/
|
|
22
|
+
export function buildDefaultToolRegistry() {
|
|
23
|
+
const registry = new ToolRegistry();
|
|
24
|
+
registry.registerAll(discoveryTools);
|
|
25
|
+
registry.registerAll(queryTools);
|
|
26
|
+
registry.registerAll(geometryTools);
|
|
27
|
+
registry.registerAll(validationTools);
|
|
28
|
+
registry.registerAll(mutationTools);
|
|
29
|
+
registry.registerAll(bcfTools);
|
|
30
|
+
registry.registerAll(bsddTools);
|
|
31
|
+
registry.registerAll(diffTools);
|
|
32
|
+
registry.registerAll(exportTools);
|
|
33
|
+
registry.registerAll(viewerTools);
|
|
34
|
+
return registry;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,EACL,cAAc,EACd,UAAU,EACV,aAAa,EACb,eAAe,EACf,aAAa,EACb,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,GACZ,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,wBAAwB;IACtC,MAAM,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;IACpC,QAAQ,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACrC,QAAQ,CAAC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