@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,549 @@
|
|
|
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
|
+
* Query tools (spec §7.2).
|
|
6
|
+
*
|
|
7
|
+
* Read-only entity discovery via the existing `bim` query API. We try to
|
|
8
|
+
* keep the structured-content shape as close to the SDK shapes as we can,
|
|
9
|
+
* because anything an agent wants to feed back into another tool comes
|
|
10
|
+
* straight from these results.
|
|
11
|
+
*/
|
|
12
|
+
import { EntityNode } from '@ifc-lite/query';
|
|
13
|
+
import { extractGeoreferencingOnDemand, extractLengthUnitScale } from '@ifc-lite/parser';
|
|
14
|
+
import { okResult, paginate, resolveModel } from './util.js';
|
|
15
|
+
import { ToolErrorCode, ToolExecutionError } from '../errors.js';
|
|
16
|
+
const COMPARISON_OPS = ['=', '!=', '>', '<', '>=', '<=', 'contains', 'exists'];
|
|
17
|
+
const queryEntities = {
|
|
18
|
+
name: 'query_entities',
|
|
19
|
+
description: 'Filter entities by IFC type, property, material, or spatial container. Returns matching IDs and minimal metadata.',
|
|
20
|
+
scope: 'read',
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
model_id: { type: 'string' },
|
|
25
|
+
type: { type: 'string', description: 'IFC entity type, e.g. "IfcWall". Includes subtypes by default.' },
|
|
26
|
+
types: { type: 'array', items: { type: 'string' }, description: 'Filter to multiple types. Combined with `type` if both supplied.' },
|
|
27
|
+
property: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
pset: { type: 'string' },
|
|
31
|
+
name: { type: 'string' },
|
|
32
|
+
op: { type: 'string', enum: COMPARISON_OPS },
|
|
33
|
+
value: {},
|
|
34
|
+
},
|
|
35
|
+
required: ['pset', 'name', 'op'],
|
|
36
|
+
additionalProperties: false,
|
|
37
|
+
},
|
|
38
|
+
in_storey: { type: 'string', description: 'GlobalId of containing storey.' },
|
|
39
|
+
limit: { type: 'integer', default: 1000, minimum: 1, maximum: 10000 },
|
|
40
|
+
offset: { type: 'integer', default: 0, minimum: 0 },
|
|
41
|
+
fields: {
|
|
42
|
+
type: 'array',
|
|
43
|
+
items: { type: 'string' },
|
|
44
|
+
default: ['globalId', 'type', 'name'],
|
|
45
|
+
description: 'Subset of EntityData fields to return. Use [] for full data.',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
additionalProperties: false,
|
|
49
|
+
},
|
|
50
|
+
handler(input, ctx) {
|
|
51
|
+
const m = resolveModel(ctx, input.model_id);
|
|
52
|
+
const types = [];
|
|
53
|
+
if (typeof input.type === 'string')
|
|
54
|
+
types.push(input.type);
|
|
55
|
+
if (Array.isArray(input.types))
|
|
56
|
+
for (const t of input.types)
|
|
57
|
+
types.push(t);
|
|
58
|
+
const filters = [];
|
|
59
|
+
if (input.property) {
|
|
60
|
+
const p = input.property;
|
|
61
|
+
filters.push({ psetName: p.pset, propName: p.name, operator: p.op, value: p.value });
|
|
62
|
+
}
|
|
63
|
+
const limit = input.limit ?? 1000;
|
|
64
|
+
const offset = input.offset ?? 0;
|
|
65
|
+
let results = m.bim.query()
|
|
66
|
+
.byType(...types);
|
|
67
|
+
if (filters.length > 0) {
|
|
68
|
+
for (const f of filters)
|
|
69
|
+
results = results.where(f.psetName, f.propName, f.operator, f.value);
|
|
70
|
+
}
|
|
71
|
+
if (input.in_storey) {
|
|
72
|
+
// No native byStorey on QueryBuilder — filter post-hoc against containment chain.
|
|
73
|
+
const storeyGid = input.in_storey;
|
|
74
|
+
const all = results.toArray();
|
|
75
|
+
const matching = all.filter((entity) => {
|
|
76
|
+
const node = new EntityNode(m.store, entity.ref.expressId);
|
|
77
|
+
const storey = node.storey();
|
|
78
|
+
return storey && storey.globalId === storeyGid;
|
|
79
|
+
});
|
|
80
|
+
const page = paginate(matching, limit, offset);
|
|
81
|
+
const shaped = shapeEntities(page.items, input.fields);
|
|
82
|
+
return okResult(formatQueryResult(page.total, page.truncated, shaped, page.items), { count: page.total, truncated: page.truncated, entities: shaped });
|
|
83
|
+
}
|
|
84
|
+
const all = results.toArray();
|
|
85
|
+
const page = paginate(all, limit, offset);
|
|
86
|
+
const shaped = shapeEntities(page.items, input.fields);
|
|
87
|
+
return okResult(formatQueryResult(page.total, page.truncated, shaped, page.items), { count: page.total, truncated: page.truncated, entities: shaped });
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
function formatQueryResult(total, truncated, _shaped, items) {
|
|
91
|
+
const head = `Found ${total.toLocaleString()} matching entit${total === 1 ? 'y' : 'ies'}${truncated ? ` (showing ${items.length})` : ''}.`;
|
|
92
|
+
if (items.length === 0)
|
|
93
|
+
return head;
|
|
94
|
+
const lines = items.slice(0, 25).map((e) => {
|
|
95
|
+
const name = e.name ? ` '${e.name}'` : '';
|
|
96
|
+
const gid = e.globalId ? ` GlobalId=${e.globalId}` : '';
|
|
97
|
+
return ` • ${e.type ?? '?'} #${e.ref.expressId}${name}${gid}`;
|
|
98
|
+
});
|
|
99
|
+
if (items.length > 25)
|
|
100
|
+
lines.push(` • … +${items.length - 25} more in this page`);
|
|
101
|
+
return [head, ...lines].join('\n');
|
|
102
|
+
}
|
|
103
|
+
function shapeEntities(entities, fields) {
|
|
104
|
+
if (!fields || fields.length === 0) {
|
|
105
|
+
// Default response: surface expressId at the top level so downstream tools
|
|
106
|
+
// (viewer_*, mutate_*, BCF, etc.) get a stable handle without the caller
|
|
107
|
+
// having to navigate `entity.ref.expressId`.
|
|
108
|
+
return entities.map((e) => ({
|
|
109
|
+
expressId: e.ref.expressId,
|
|
110
|
+
modelId: e.ref.modelId,
|
|
111
|
+
globalId: e.globalId,
|
|
112
|
+
name: e.name,
|
|
113
|
+
type: e.type,
|
|
114
|
+
description: e.description,
|
|
115
|
+
objectType: e.objectType,
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
const fieldSet = new Set(fields);
|
|
119
|
+
return entities.map((e) => {
|
|
120
|
+
const out = {};
|
|
121
|
+
if (fieldSet.has('expressId'))
|
|
122
|
+
out.expressId = e.ref.expressId;
|
|
123
|
+
if (fieldSet.has('modelId'))
|
|
124
|
+
out.modelId = e.ref.modelId;
|
|
125
|
+
if (fieldSet.has('globalId'))
|
|
126
|
+
out.globalId = e.globalId;
|
|
127
|
+
if (fieldSet.has('name'))
|
|
128
|
+
out.name = e.name;
|
|
129
|
+
if (fieldSet.has('type'))
|
|
130
|
+
out.type = e.type;
|
|
131
|
+
if (fieldSet.has('description'))
|
|
132
|
+
out.description = e.description;
|
|
133
|
+
if (fieldSet.has('objectType'))
|
|
134
|
+
out.objectType = e.objectType;
|
|
135
|
+
return out;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const countEntities = {
|
|
139
|
+
name: 'count_entities',
|
|
140
|
+
description: 'Count entities, optionally grouped by a key (type, storey, material). Returns aggregates rather than the full set.',
|
|
141
|
+
scope: 'read',
|
|
142
|
+
inputSchema: {
|
|
143
|
+
type: 'object',
|
|
144
|
+
properties: {
|
|
145
|
+
model_id: { type: 'string' },
|
|
146
|
+
type: { type: 'string' },
|
|
147
|
+
group_by: { type: 'string', enum: ['type', 'storey', 'material'] },
|
|
148
|
+
},
|
|
149
|
+
additionalProperties: false,
|
|
150
|
+
},
|
|
151
|
+
handler(input, ctx) {
|
|
152
|
+
const m = resolveModel(ctx, input.model_id);
|
|
153
|
+
const groupBy = input.group_by;
|
|
154
|
+
const typeFilter = input.type;
|
|
155
|
+
if (!groupBy) {
|
|
156
|
+
const total = typeFilter
|
|
157
|
+
? m.bim.query().byType(typeFilter).toArray().length
|
|
158
|
+
: Array.from(m.store.entityIndex.byType.values()).reduce((sum, ids) => sum + ids.length, 0);
|
|
159
|
+
return okResult(`${total.toLocaleString()} entities${typeFilter ? ` of type ${typeFilter}` : ''}.`, { total });
|
|
160
|
+
}
|
|
161
|
+
const groups = new Map();
|
|
162
|
+
if (groupBy === 'type') {
|
|
163
|
+
for (const [type, ids] of m.store.entityIndex.byType) {
|
|
164
|
+
groups.set(type, ids.length);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else if (groupBy === 'storey') {
|
|
168
|
+
const targets = typeFilter ? m.bim.query().byType(typeFilter).toArray() : m.bim.query().toArray();
|
|
169
|
+
for (const e of targets) {
|
|
170
|
+
const node = new EntityNode(m.store, e.ref.expressId);
|
|
171
|
+
const storey = node.storey();
|
|
172
|
+
const key = storey ? (storey.name || `Storey ${storey.expressId}`) : '(none)';
|
|
173
|
+
groups.set(key, (groups.get(key) ?? 0) + 1);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else if (groupBy === 'material') {
|
|
177
|
+
const targets = typeFilter ? m.bim.query().byType(typeFilter).toArray() : m.bim.query().toArray();
|
|
178
|
+
for (const e of targets) {
|
|
179
|
+
const mat = m.bim.materials(e.ref);
|
|
180
|
+
const key = mat?.name ?? '(no material)';
|
|
181
|
+
groups.set(key, (groups.get(key) ?? 0) + 1);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const sorted = Array.from(groups.entries())
|
|
185
|
+
.sort((a, b) => b[1] - a[1])
|
|
186
|
+
.map(([key, count]) => ({ key, count }));
|
|
187
|
+
return okResult(`Counted ${sorted.length} groups by ${groupBy}.`, { groupBy, groups: sorted, total: sorted.reduce((s, g) => s + g.count, 0) });
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
const getEntity = {
|
|
191
|
+
name: 'get_entity',
|
|
192
|
+
description: 'Full data for a single entity: attributes, properties, quantities, classifications, materials, relationships.',
|
|
193
|
+
scope: 'read',
|
|
194
|
+
inputSchema: {
|
|
195
|
+
type: 'object',
|
|
196
|
+
properties: {
|
|
197
|
+
model_id: { type: 'string' },
|
|
198
|
+
global_id: { type: 'string' },
|
|
199
|
+
express_id: { type: 'integer', minimum: 1 },
|
|
200
|
+
include: {
|
|
201
|
+
type: 'array',
|
|
202
|
+
items: { type: 'string', enum: ['attributes', 'properties', 'quantities', 'classifications', 'materials', 'documents', 'relationships', 'type_properties'] },
|
|
203
|
+
default: ['attributes', 'properties', 'quantities', 'classifications', 'materials'],
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
additionalProperties: false,
|
|
207
|
+
},
|
|
208
|
+
handler(input, ctx) {
|
|
209
|
+
const m = resolveModel(ctx, input.model_id);
|
|
210
|
+
const expressId = resolveExpressId(m, input);
|
|
211
|
+
const ref = { modelId: m.id, expressId };
|
|
212
|
+
const data = m.bim.entity(ref);
|
|
213
|
+
if (!data) {
|
|
214
|
+
throw new ToolExecutionError({
|
|
215
|
+
code: ToolErrorCode.ENTITY_NOT_FOUND,
|
|
216
|
+
message: `Entity not found in model '${m.id}'`,
|
|
217
|
+
details: { model_id: m.id, express_id: expressId },
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
const include = new Set(input.include ?? ['attributes', 'properties', 'quantities', 'classifications', 'materials']);
|
|
221
|
+
const out = {
|
|
222
|
+
ref: data.ref,
|
|
223
|
+
globalId: data.globalId,
|
|
224
|
+
name: data.name,
|
|
225
|
+
type: data.type,
|
|
226
|
+
description: data.description,
|
|
227
|
+
objectType: data.objectType,
|
|
228
|
+
};
|
|
229
|
+
if (include.has('attributes'))
|
|
230
|
+
out.attributes = m.bim.attributes(ref);
|
|
231
|
+
if (include.has('properties'))
|
|
232
|
+
out.properties = m.bim.properties(ref);
|
|
233
|
+
if (include.has('quantities'))
|
|
234
|
+
out.quantities = m.bim.quantities(ref);
|
|
235
|
+
if (include.has('classifications'))
|
|
236
|
+
out.classifications = m.bim.classifications(ref);
|
|
237
|
+
if (include.has('materials'))
|
|
238
|
+
out.materials = m.bim.materials(ref);
|
|
239
|
+
if (include.has('documents'))
|
|
240
|
+
out.documents = m.bim.documents(ref);
|
|
241
|
+
if (include.has('relationships'))
|
|
242
|
+
out.relationships = m.bim.relationships(ref);
|
|
243
|
+
if (include.has('type_properties'))
|
|
244
|
+
out.typeProperties = m.bim.typeProperties(ref);
|
|
245
|
+
return okResult(`${data.type} '${data.name || data.globalId}' (#${expressId})`, out);
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
function resolveExpressId(m, input) {
|
|
249
|
+
if (typeof input.express_id === 'number')
|
|
250
|
+
return input.express_id;
|
|
251
|
+
if (typeof input.global_id === 'string') {
|
|
252
|
+
const gid = input.global_id;
|
|
253
|
+
for (const [, ids] of m.store.entityIndex.byType) {
|
|
254
|
+
for (const id of ids) {
|
|
255
|
+
const node = new EntityNode(m.store, id);
|
|
256
|
+
if (node.globalId === gid)
|
|
257
|
+
return id;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
throw new ToolExecutionError({
|
|
261
|
+
code: ToolErrorCode.ENTITY_NOT_FOUND,
|
|
262
|
+
message: `No entity with GlobalId '${gid}' in this model.`,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
throw new ToolExecutionError({
|
|
266
|
+
code: ToolErrorCode.INVALID_INPUT,
|
|
267
|
+
message: 'Provide either `global_id` or `express_id`.',
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
const getEntitiesBulk = {
|
|
271
|
+
name: 'get_entities_bulk',
|
|
272
|
+
description: 'Batch version of get_entity. Up to 1000 IDs per call. Returns a map keyed by globalId.',
|
|
273
|
+
scope: 'read',
|
|
274
|
+
inputSchema: {
|
|
275
|
+
type: 'object',
|
|
276
|
+
properties: {
|
|
277
|
+
model_id: { type: 'string' },
|
|
278
|
+
global_ids: { type: 'array', items: { type: 'string' }, maxLength: 1000 },
|
|
279
|
+
express_ids: { type: 'array', items: { type: 'integer' }, maxLength: 1000 },
|
|
280
|
+
include: {
|
|
281
|
+
type: 'array',
|
|
282
|
+
items: { type: 'string' },
|
|
283
|
+
default: ['attributes'],
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
additionalProperties: false,
|
|
287
|
+
},
|
|
288
|
+
handler(input, ctx) {
|
|
289
|
+
const m = resolveModel(ctx, input.model_id);
|
|
290
|
+
const include = new Set(input.include ?? ['attributes']);
|
|
291
|
+
const ids = [];
|
|
292
|
+
if (Array.isArray(input.express_ids))
|
|
293
|
+
for (const id of input.express_ids)
|
|
294
|
+
ids.push(id);
|
|
295
|
+
if (Array.isArray(input.global_ids)) {
|
|
296
|
+
const gids = new Set(input.global_ids);
|
|
297
|
+
for (const [, list] of m.store.entityIndex.byType) {
|
|
298
|
+
for (const id of list) {
|
|
299
|
+
const node = new EntityNode(m.store, id);
|
|
300
|
+
if (gids.has(node.globalId))
|
|
301
|
+
ids.push(id);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (ids.length > 1000) {
|
|
306
|
+
throw new ToolExecutionError({
|
|
307
|
+
code: ToolErrorCode.INVALID_INPUT,
|
|
308
|
+
message: 'Bulk call exceeds 1000 entities.',
|
|
309
|
+
hint: 'Page using `query_entities` with offset.',
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
const entities = {};
|
|
313
|
+
for (const id of ids) {
|
|
314
|
+
const ref = { modelId: m.id, expressId: id };
|
|
315
|
+
const data = m.bim.entity(ref);
|
|
316
|
+
if (!data)
|
|
317
|
+
continue;
|
|
318
|
+
const e = { ...data };
|
|
319
|
+
if (include.has('properties'))
|
|
320
|
+
e.properties = m.bim.properties(ref);
|
|
321
|
+
if (include.has('quantities'))
|
|
322
|
+
e.quantities = m.bim.quantities(ref);
|
|
323
|
+
if (include.has('classifications'))
|
|
324
|
+
e.classifications = m.bim.classifications(ref);
|
|
325
|
+
if (include.has('materials'))
|
|
326
|
+
e.materials = m.bim.materials(ref);
|
|
327
|
+
entities[data.globalId] = e;
|
|
328
|
+
}
|
|
329
|
+
return okResult(`Resolved ${Object.keys(entities).length} entities.`, { entities });
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
const spatialHierarchy = {
|
|
333
|
+
name: 'spatial_hierarchy',
|
|
334
|
+
description: 'Project → Site → Building → Storey → Space tree. Compact form by default (set `include_elements` to expand).',
|
|
335
|
+
scope: 'read',
|
|
336
|
+
inputSchema: {
|
|
337
|
+
type: 'object',
|
|
338
|
+
properties: {
|
|
339
|
+
model_id: { type: 'string' },
|
|
340
|
+
include_elements: { type: 'boolean', default: false, description: 'Include expressIds of contained elements per spatial node.' },
|
|
341
|
+
},
|
|
342
|
+
additionalProperties: false,
|
|
343
|
+
},
|
|
344
|
+
handler(input, ctx) {
|
|
345
|
+
const m = resolveModel(ctx, input.model_id);
|
|
346
|
+
const includeElements = input.include_elements ?? false;
|
|
347
|
+
const tree = compactSpatialTree(m, includeElements);
|
|
348
|
+
return okResult(`Spatial hierarchy for '${m.name}'.`, { tree });
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
function compactSpatialTree(m, includeElements) {
|
|
352
|
+
const projectIds = m.store.entityIndex.byType.get('IFCPROJECT') ?? [];
|
|
353
|
+
if (projectIds.length === 0)
|
|
354
|
+
return null;
|
|
355
|
+
return buildNode(m, projectIds[0], includeElements);
|
|
356
|
+
}
|
|
357
|
+
function buildNode(m, expressId, includeElements) {
|
|
358
|
+
const node = new EntityNode(m.store, expressId);
|
|
359
|
+
const children = node.decomposes().map((c) => buildNode(m, c.expressId, includeElements));
|
|
360
|
+
for (const c of node.contains()) {
|
|
361
|
+
if (children.find((cc) => cc.expressId === c.expressId))
|
|
362
|
+
continue;
|
|
363
|
+
children.push(buildNode(m, c.expressId, includeElements));
|
|
364
|
+
}
|
|
365
|
+
const out = {
|
|
366
|
+
expressId,
|
|
367
|
+
globalId: node.globalId,
|
|
368
|
+
type: node.type,
|
|
369
|
+
name: node.name,
|
|
370
|
+
children,
|
|
371
|
+
};
|
|
372
|
+
if (includeElements) {
|
|
373
|
+
out.elements = node.contains().map((e) => e.expressId);
|
|
374
|
+
}
|
|
375
|
+
return out;
|
|
376
|
+
}
|
|
377
|
+
const containmentChain = {
|
|
378
|
+
name: 'containment_chain',
|
|
379
|
+
description: 'For an entity, return its spatial containment chain from the entity up to the project root.',
|
|
380
|
+
scope: 'read',
|
|
381
|
+
inputSchema: {
|
|
382
|
+
type: 'object',
|
|
383
|
+
properties: {
|
|
384
|
+
model_id: { type: 'string' },
|
|
385
|
+
global_id: { type: 'string' },
|
|
386
|
+
express_id: { type: 'integer' },
|
|
387
|
+
},
|
|
388
|
+
additionalProperties: false,
|
|
389
|
+
},
|
|
390
|
+
handler(input, ctx) {
|
|
391
|
+
const m = resolveModel(ctx, input.model_id);
|
|
392
|
+
const expressId = resolveExpressId(m, input);
|
|
393
|
+
const ref = { modelId: m.id, expressId };
|
|
394
|
+
const path = m.bim.path(ref);
|
|
395
|
+
return okResult(`${path.length}-step containment path.`, {
|
|
396
|
+
path: path.map((p) => ({ expressId: p.ref.expressId, globalId: p.globalId, type: p.type, name: p.name })),
|
|
397
|
+
});
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
const relationships = {
|
|
401
|
+
name: 'relationships',
|
|
402
|
+
description: 'Inbound and outbound relationships of an entity (voids, fills, groups, connections, …).',
|
|
403
|
+
scope: 'read',
|
|
404
|
+
inputSchema: {
|
|
405
|
+
type: 'object',
|
|
406
|
+
properties: {
|
|
407
|
+
model_id: { type: 'string' },
|
|
408
|
+
global_id: { type: 'string' },
|
|
409
|
+
express_id: { type: 'integer' },
|
|
410
|
+
},
|
|
411
|
+
additionalProperties: false,
|
|
412
|
+
},
|
|
413
|
+
handler(input, ctx) {
|
|
414
|
+
const m = resolveModel(ctx, input.model_id);
|
|
415
|
+
const expressId = resolveExpressId(m, input);
|
|
416
|
+
return okResult('Relationships', m.bim.relationships({ modelId: m.id, expressId }));
|
|
417
|
+
},
|
|
418
|
+
};
|
|
419
|
+
const propertiesUnique = {
|
|
420
|
+
name: 'properties_unique',
|
|
421
|
+
description: 'Unique values for a single property across a type set. Useful for filter UIs and stats.',
|
|
422
|
+
scope: 'read',
|
|
423
|
+
inputSchema: {
|
|
424
|
+
type: 'object',
|
|
425
|
+
properties: {
|
|
426
|
+
model_id: { type: 'string' },
|
|
427
|
+
type: { type: 'string' },
|
|
428
|
+
pset: { type: 'string' },
|
|
429
|
+
property: { type: 'string' },
|
|
430
|
+
},
|
|
431
|
+
required: ['type', 'pset', 'property'],
|
|
432
|
+
additionalProperties: false,
|
|
433
|
+
},
|
|
434
|
+
handler(input, ctx) {
|
|
435
|
+
const m = resolveModel(ctx, input.model_id);
|
|
436
|
+
const type = input.type;
|
|
437
|
+
const psetName = input.pset;
|
|
438
|
+
const propName = input.property;
|
|
439
|
+
const counts = new Map();
|
|
440
|
+
let total = 0;
|
|
441
|
+
for (const e of m.bim.query().byType(type).toArray()) {
|
|
442
|
+
const v = m.bim.property(e.ref, psetName, propName);
|
|
443
|
+
const key = v == null ? '(missing)' : String(v);
|
|
444
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
445
|
+
total++;
|
|
446
|
+
}
|
|
447
|
+
const values = Array.from(counts.entries())
|
|
448
|
+
.sort((a, b) => b[1] - a[1])
|
|
449
|
+
.map(([value, count]) => ({ value, count }));
|
|
450
|
+
// Rich text content so MCP clients that only forward content[].text to the
|
|
451
|
+
// model still get the actual histogram, not just the count.
|
|
452
|
+
const head = `${values.length} unique value(s) for ${type}.${psetName}.${propName} across ${total} entit${total === 1 ? 'y' : 'ies'}:`;
|
|
453
|
+
const lines = values.slice(0, 50).map((v) => ` • ${v.value} — ${v.count}`);
|
|
454
|
+
if (values.length > 50)
|
|
455
|
+
lines.push(` • … +${values.length - 50} more`);
|
|
456
|
+
return okResult([head, ...lines].join('\n'), { values, total });
|
|
457
|
+
},
|
|
458
|
+
};
|
|
459
|
+
const materialsList = {
|
|
460
|
+
name: 'materials_list',
|
|
461
|
+
description: 'All materials present in the model with usage counts.',
|
|
462
|
+
scope: 'read',
|
|
463
|
+
inputSchema: {
|
|
464
|
+
type: 'object',
|
|
465
|
+
properties: { model_id: { type: 'string' } },
|
|
466
|
+
additionalProperties: false,
|
|
467
|
+
},
|
|
468
|
+
handler(input, ctx) {
|
|
469
|
+
const m = resolveModel(ctx, input.model_id);
|
|
470
|
+
const counts = new Map();
|
|
471
|
+
for (const e of m.bim.query().toArray()) {
|
|
472
|
+
const mat = m.bim.materials(e.ref);
|
|
473
|
+
if (!mat)
|
|
474
|
+
continue;
|
|
475
|
+
const key = mat.name ?? '(unnamed)';
|
|
476
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
477
|
+
}
|
|
478
|
+
const list = Array.from(counts.entries()).sort((a, b) => b[1] - a[1]).map(([name, count]) => ({ name, count }));
|
|
479
|
+
const head = `${list.length} distinct material(s) in use:`;
|
|
480
|
+
const lines = list.slice(0, 50).map((m) => ` • ${m.name} — ${m.count}`);
|
|
481
|
+
if (list.length > 50)
|
|
482
|
+
lines.push(` • … +${list.length - 50} more`);
|
|
483
|
+
return okResult([head, ...lines].join('\n'), { materials: list });
|
|
484
|
+
},
|
|
485
|
+
};
|
|
486
|
+
const classificationsList = {
|
|
487
|
+
name: 'classifications_list',
|
|
488
|
+
description: 'All classification references in the model with usage counts.',
|
|
489
|
+
scope: 'read',
|
|
490
|
+
inputSchema: {
|
|
491
|
+
type: 'object',
|
|
492
|
+
properties: { model_id: { type: 'string' } },
|
|
493
|
+
additionalProperties: false,
|
|
494
|
+
},
|
|
495
|
+
handler(input, ctx) {
|
|
496
|
+
const m = resolveModel(ctx, input.model_id);
|
|
497
|
+
const counts = new Map();
|
|
498
|
+
for (const e of m.bim.query().toArray()) {
|
|
499
|
+
for (const c of m.bim.classifications(e.ref)) {
|
|
500
|
+
const key = `${c.system ?? '?'}:${c.identification ?? c.name ?? '?'}`;
|
|
501
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
const list = Array.from(counts.entries()).sort((a, b) => b[1] - a[1]).map(([key, count]) => ({ key, count }));
|
|
505
|
+
const head = `${list.length} distinct classification reference(s):`;
|
|
506
|
+
const lines = list.slice(0, 50).map((c) => ` • ${c.key} — ${c.count}`);
|
|
507
|
+
if (list.length > 50)
|
|
508
|
+
lines.push(` • … +${list.length - 50} more`);
|
|
509
|
+
return okResult([head, ...lines].join('\n'), { classifications: list });
|
|
510
|
+
},
|
|
511
|
+
};
|
|
512
|
+
const georeferencing = {
|
|
513
|
+
name: 'georeferencing',
|
|
514
|
+
description: 'Coordinate reference system, MapConversion, project north and true north.',
|
|
515
|
+
scope: 'read',
|
|
516
|
+
inputSchema: { type: 'object', properties: { model_id: { type: 'string' } }, additionalProperties: false },
|
|
517
|
+
handler(input, ctx) {
|
|
518
|
+
const m = resolveModel(ctx, input.model_id);
|
|
519
|
+
return okResult('Georeferencing', { georeferencing: extractGeoreferencingOnDemand(m.store) ?? null });
|
|
520
|
+
},
|
|
521
|
+
};
|
|
522
|
+
const units = {
|
|
523
|
+
name: 'units',
|
|
524
|
+
description: 'Length unit scale (factor that converts stored lengths to meters) and other unit metadata.',
|
|
525
|
+
scope: 'read',
|
|
526
|
+
inputSchema: { type: 'object', properties: { model_id: { type: 'string' } }, additionalProperties: false },
|
|
527
|
+
handler(input, ctx) {
|
|
528
|
+
const m = resolveModel(ctx, input.model_id);
|
|
529
|
+
const scale = m.store.source && m.store.entityIndex
|
|
530
|
+
? extractLengthUnitScale(m.store.source, m.store.entityIndex)
|
|
531
|
+
: 1.0;
|
|
532
|
+
return okResult(`Length unit scale: ${scale} (lengths × ${scale} → meters).`, { lengthUnitScale: scale });
|
|
533
|
+
},
|
|
534
|
+
};
|
|
535
|
+
export const queryTools = [
|
|
536
|
+
queryEntities,
|
|
537
|
+
countEntities,
|
|
538
|
+
getEntity,
|
|
539
|
+
getEntitiesBulk,
|
|
540
|
+
spatialHierarchy,
|
|
541
|
+
containmentChain,
|
|
542
|
+
relationships,
|
|
543
|
+
propertiesUnique,
|
|
544
|
+
materialsList,
|
|
545
|
+
classificationsList,
|
|
546
|
+
georeferencing,
|
|
547
|
+
units,
|
|
548
|
+
];
|
|
549
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAGzF,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,cAAc,GAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAE/F,MAAM,aAAa,GAAS;IAC1B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,mHAAmH;IAChI,KAAK,EAAE,MAAM;IACb,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC5B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gEAAgE,EAAE;YACvG,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,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,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5G,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAW;IAChC,aAAa;IACb,aAAa;IACb,SAAS;IACT,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,mBAAmB;IACnB,cAAc;IACd,KAAK;CACN,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CallToolResult, JsonSchema, ToolScope } from '../protocol/index.js';
|
|
2
|
+
import type { ToolContext } from '../context.js';
|
|
3
|
+
export interface Tool {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: JsonSchema;
|
|
7
|
+
scope?: ToolScope;
|
|
8
|
+
handler(input: Record<string, unknown>, ctx: ToolContext): Promise<CallToolResult> | CallToolResult;
|
|
9
|
+
}
|
|
10
|
+
export declare class ToolRegistry {
|
|
11
|
+
private tools;
|
|
12
|
+
register(tool: Tool): void;
|
|
13
|
+
registerAll(tools: Tool[]): void;
|
|
14
|
+
get(name: string): Tool | null;
|
|
15
|
+
list(): Tool[];
|
|
16
|
+
has(name: string): boolean;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAAC;CACrG;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAA2B;IAExC,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAO1B,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAIhC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAI9B,IAAI,IAAI,IAAI,EAAE;IAId,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG3B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
export class ToolRegistry {
|
|
5
|
+
tools = new Map();
|
|
6
|
+
register(tool) {
|
|
7
|
+
if (this.tools.has(tool.name)) {
|
|
8
|
+
throw new Error(`Duplicate tool registration: ${tool.name}`);
|
|
9
|
+
}
|
|
10
|
+
this.tools.set(tool.name, tool);
|
|
11
|
+
}
|
|
12
|
+
registerAll(tools) {
|
|
13
|
+
for (const tool of tools)
|
|
14
|
+
this.register(tool);
|
|
15
|
+
}
|
|
16
|
+
get(name) {
|
|
17
|
+
return this.tools.get(name) ?? null;
|
|
18
|
+
}
|
|
19
|
+
list() {
|
|
20
|
+
return Array.from(this.tools.values());
|
|
21
|
+
}
|
|
22
|
+
has(name) {
|
|
23
|
+
return this.tools.has(name);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAa/D,MAAM,OAAO,YAAY;IACf,KAAK,GAAG,IAAI,GAAG,EAAgB,CAAC;IAExC,QAAQ,CAAC,IAAU;QACjB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,WAAW,CAAC,KAAa;QACvB,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;IACtC,CAAC;IAED,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF"}
|