@constructorfleet/sketchforge3d 1.31.0 → 1.33.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.
Files changed (46) hide show
  1. package/README.md +65 -3
  2. package/dist/cli.d.ts +3 -1
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +97 -6
  5. package/dist/cli.js.map +1 -1
  6. package/dist/client.d.ts +41 -2
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +63 -0
  9. package/dist/client.js.map +1 -1
  10. package/dist/errors.d.ts +39 -1
  11. package/dist/errors.d.ts.map +1 -1
  12. package/dist/errors.js +105 -2
  13. package/dist/errors.js.map +1 -1
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +3 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/resources/configurations.d.ts +21 -0
  19. package/dist/resources/configurations.d.ts.map +1 -0
  20. package/dist/resources/configurations.js +44 -0
  21. package/dist/resources/configurations.js.map +1 -0
  22. package/dist/resources/parameters.d.ts +16 -0
  23. package/dist/resources/parameters.d.ts.map +1 -0
  24. package/dist/resources/parameters.js +53 -0
  25. package/dist/resources/parameters.js.map +1 -0
  26. package/dist/resources/sketch-constraints.d.ts +11 -0
  27. package/dist/resources/sketch-constraints.d.ts.map +1 -0
  28. package/dist/resources/sketch-constraints.js +24 -0
  29. package/dist/resources/sketch-constraints.js.map +1 -0
  30. package/dist/types.d.ts +160 -4
  31. package/dist/types.d.ts.map +1 -1
  32. package/dist/types.js +1 -0
  33. package/dist/types.js.map +1 -1
  34. package/examples/parametric-box.macro.mjs +44 -0
  35. package/mcp/filesystemPaths.mjs +9 -2
  36. package/mcp/hosted.d.mts +10 -0
  37. package/mcp/hosted.mjs +79 -0
  38. package/mcp/localEngine.mjs +15 -6
  39. package/mcp/operation-parity.mjs +12 -1
  40. package/mcp/parameterTools.mjs +253 -0
  41. package/mcp/protocol.mjs +87 -0
  42. package/mcp/server.mjs +10 -960
  43. package/mcp/streamableHttp.mjs +116 -0
  44. package/mcp/toolCatalog.mjs +758 -0
  45. package/mcp/tools.mjs +296 -0
  46. package/package.json +2 -2
@@ -0,0 +1,758 @@
1
+ /** Declares every editor and local-engine tool. Pure data: safe to load in any host. */
2
+
3
+ import {
4
+ CREATE_SHAPE_KINDS,
5
+ EDITOR_SHAPE_KINDS,
6
+ LOCAL_SHAPE_KINDS,
7
+ LOCAL_SOLID_KINDS,
8
+ LOCAL_STORED_KINDS,
9
+ STEP_KINDS,
10
+ TAPER_KINDS,
11
+ } from "./createShapeKinds.mjs";
12
+
13
+ /** What a drawing shows, as `POST /exports` and the engine name it. Kept in step by `localMcpEngine.test.ts`. */
14
+ const PROJECTION_LAYOUTS = ["multiview", "front", "back", "top", "bottom", "left", "right", "iso"];
15
+ const SECTION_PLANES = ["xy", "xz", "yz"];
16
+
17
+
18
+ const editorTargetSchema = {
19
+ type: "object",
20
+ properties: {
21
+ url: { type: "string", description: "Optional SketchForge server URL. Omit to work offline with local project files." },
22
+ projectId: { type: "string", description: "Project id in SKETCHFORGE_PROJECTS_DIR when running the MCP in local mode." },
23
+ editorNumber: { type: "number", description: "The 5-digit SketchForge editor number from sketchforge_list_editors." },
24
+ editorId: { type: "string", description: "Optional internal editor id. Prefer editorNumber for human-directed use." },
25
+ timeoutMs: { type: "number", description: "Command timeout in milliseconds. Defaults to 15000." },
26
+ },
27
+ };
28
+ const localProjectSchema = { type: "object", properties: {} };
29
+ /** What group_objects and boolean_cut may name and colour the shape they leave behind. */
30
+ const resultAttributeProperties = {
31
+ name: { type: "string", description: "Name for the result (default \"Group\")." },
32
+ color: { type: "string", description: "Color for the result, stored as given as create_shape stores its color, such as #2a9d8f (default the first solid's color)." },
33
+ };
34
+
35
+ const urlProperty = { type: "string", description: "Optional SketchForge server URL. Omit to work offline with local project files." };
36
+ const projectIdProperty = { type: "string", description: "The project id." };
37
+ const PARAMETER_DIMENSIONS = ["length", "angle", "unitless"];
38
+ const WORKS_BOTH_WAYS = "Works offline or against a server when url is supplied.";
39
+ const REFUSAL_FORMAT = "A refusal ends its first line with [code]; a second line, when present, is JSON detail.";
40
+
41
+ export const engineTools = [
42
+ {
43
+ name: "sketchforge_list_projects",
44
+ description: "List projects stored in SKETCHFORGE_PROJECTS_DIR for offline MCP use.",
45
+ inputSchema: localProjectSchema,
46
+ },
47
+ {
48
+ name: "sketchforge_create_project",
49
+ description: "Create an empty project in the local SKETCHFORGE_PROJECTS_DIR.",
50
+ inputSchema: { ...localProjectSchema, required: ["name"], properties: { name: { type: "string" } } },
51
+ },
52
+ {
53
+ name: "sketchforge_import_project",
54
+ description: "Import a local .skf file as a new project in SKETCHFORGE_PROJECTS_DIR. File reads are confined to SKETCHFORGE_MCP_FILES_DIR, or SKETCHFORGE_PROJECTS_DIR when unset; if both are unset, paths are unrestricted.",
55
+ inputSchema: { ...localProjectSchema, required: ["filePath"], properties: { filePath: { type: "string", description: "Path to a .skf under SKETCHFORGE_MCP_FILES_DIR (or SKETCHFORGE_PROJECTS_DIR when unset); unrestricted if neither is set." }, name: { type: "string" } } },
56
+ },
57
+ {
58
+ name: "sketchforge_list_editors",
59
+ description: "List SketchForge editor tabs that are currently open and heartbeating, including editorNumber and projectName.",
60
+ inputSchema: { ...editorTargetSchema, properties: { url: editorTargetSchema.properties.url } },
61
+ },
62
+ {
63
+ name: "sketchforge_read_scene",
64
+ description: "Read the current scene and exact object dimensions from local project files by default, or from an editor when a server url is supplied.",
65
+ inputSchema: {
66
+ ...editorTargetSchema,
67
+ properties: {
68
+ ...editorTargetSchema.properties,
69
+ includeRawShapes: { type: "boolean", description: "Include raw WorkplaneShape JSON. Can be large for imported meshes." },
70
+ shapeIds: { type: "array", items: { type: "string" }, description: "Limit the response to these object ids (including rawShapes)." },
71
+ excludeShapeIds: { type: "array", items: { type: "string" }, description: "Omit these object ids, useful for large reference meshes." },
72
+ includeRawShapeIds: { type: "array", items: { type: "string" }, description: "Include raw geometry only for these ids; takes precedence over includeRawShapes." },
73
+ },
74
+ },
75
+ },
76
+ {
77
+ name: "sketchforge_list_objects",
78
+ description: "List all objects in the local project by default, or in the editor when a server url is supplied, with exact dimensions, position, rotation, and object ids.",
79
+ inputSchema: editorTargetSchema,
80
+ },
81
+ {
82
+ name: "sketchforge_select_objects",
83
+ description: "Select objects by id in the SketchForge editor.",
84
+ inputSchema: {
85
+ ...editorTargetSchema,
86
+ required: ["ids"],
87
+ properties: {
88
+ ...editorTargetSchema.properties,
89
+ ids: { type: "array", items: { type: "string" } },
90
+ },
91
+ },
92
+ },
93
+ {
94
+ name: "sketchforge_mirror_objects",
95
+ description: "Mirror objects across the center plane of their combined bounds, using the editor's mirror behavior.",
96
+ inputSchema: { ...editorTargetSchema, required: ["axis"], properties: { ...editorTargetSchema.properties, ids: { type: "array", items: { type: "string" }, description: "Object ids; defaults to the current selection." }, axis: { type: "string", enum: ["x", "y", "z"] } } },
97
+ },
98
+ {
99
+ name: "sketchforge_mirror_baked",
100
+ description: "Reflect exact parameter-built solids across their shared bounds plane and bake the result to BREP. Imported meshes, groups, and previously treated shapes are refused.",
101
+ inputSchema: { ...editorTargetSchema, required: ["projectId", "ids", "axis"], properties: { ...editorTargetSchema.properties, projectId: { type: "string" }, ids: { type: "array", minItems: 1, items: { type: "string" } }, axis: { type: "string", enum: ["x", "y", "z"] } } },
102
+ },
103
+ {
104
+ name: "sketchforge_delete_objects",
105
+ description: "Delete objects by id, or delete the current selection when ids are omitted.",
106
+ inputSchema: {
107
+ ...editorTargetSchema,
108
+ properties: {
109
+ ...editorTargetSchema.properties,
110
+ ids: { type: "array", items: { type: "string" } },
111
+ id: { type: "string" },
112
+ },
113
+ },
114
+ },
115
+ {
116
+ name: "sketchforge_create_shape",
117
+ description: `Create a parameterized shape, extruded sketch, revolve, or standard screw thread in SketchForge. Local mode (no url) accepts ${LOCAL_SHAPE_KINDS.join(", ")}; the kind description says which of those it can measure and export. An editor (url) builds ${EDITOR_SHAPE_KINDS.join(", ")}. sketch is editor-only. Each parameter's description names the kinds it applies to.`,
118
+ inputSchema: {
119
+ ...editorTargetSchema,
120
+ required: ["kind"],
121
+ properties: {
122
+ ...editorTargetSchema.properties,
123
+ kind: {
124
+ type: "string",
125
+ enum: CREATE_SHAPE_KINDS,
126
+ description: [
127
+ `Local mode builds ${LOCAL_SOLID_KINDS.join(", ")} as solids that measure and export as STL.`,
128
+ "A roundRoof's height may be at most half its width; a taller one fails to build.",
129
+ `${LOCAL_STORED_KINDS.join(", ")} are stored only: local mode records the parameters but cannot measure or export them; open the project in an editor for those.`,
130
+ `STEP export holds only ${STEP_KINDS.join(", ")}; export the other solids as STL.`,
131
+ "revolve there means a plain revolve: no pitch, no coreRadius, one closed profile region with straight edges, and not resized unevenly across its axis; any other revolve, like a thread, exports as STL only. A plain revolve is in STEP only when exported by the server or local mode, from its exact solid; an open editor's own STEP export skips it.",
132
+ "sketch is editor-only: it needs an open editor (url), and local mode refuses it.",
133
+ `An editor builds only ${EDITOR_SHAPE_KINDS.join(", ")}.`,
134
+ ].join(" "),
135
+ },
136
+ profile: {
137
+ type: "array",
138
+ description: "For kind sketch: a closed 2D outline to extrude, as [x, z] pairs. For kind revolve: the closed outline to revolve, where x is distance from axis and z runs along it.",
139
+ items: { type: "array", items: { type: "number" }, minItems: 2, maxItems: 2 },
140
+ },
141
+ pitch: { type: "number", description: "For kind revolve/thread: axial rise per turn in mm. 0 is a plain revolve; negative is a left-hand thread." },
142
+ turns: { type: "number", description: "For kind revolve/thread: how many full turns to sweep (default 8 for a thread)." },
143
+ diameter: { type: "number", description: "For kind thread: outside diameter in mm, for a size the catalog does not list. The 60-degree ISO profile follows from this and the pitch." },
144
+ length: { type: "number", description: "For kind thread: how long the thread should be in mm, instead of giving turns." },
145
+ hole: {
146
+ type: "boolean",
147
+ description: "Any kind: create the shape as a hole (a cutter), so grouping it with a solid cuts it out of that solid without a separate update_object call. For kind thread it also cuts the form wider by a clearance so a bolt of that size fits, which taps the solid.",
148
+ },
149
+ clearance: { type: "number", description: "For kind thread with hole: how much wider to cut, per side, in mm (default 0.2 for printed parts)." },
150
+ startAngle: { type: "number", description: "For kind revolve: rotation the sweep starts at, in degrees." },
151
+ sweepAngle: { type: "number", description: "For kind revolve with no pitch: how far round to revolve, in degrees (±360). x/z place the axis of revolution, so a partial sweep lies to one side of them; the result's x/z is its box centre, and local mode reports the axis as revolveAxis." },
152
+ name: { type: "string" },
153
+ color: { type: "string" },
154
+ x: { type: "number" },
155
+ z: { type: "number" },
156
+ elevation: { type: "number" },
157
+ width: { type: "number", description: "For loft, this is the bottom end's width." },
158
+ depth: { type: "number", description: "For loft, this is the bottom end's depth." },
159
+ height: { type: "number" },
160
+ size: {
161
+ type: ["number", "string"],
162
+ description: 'A number sets width, depth and height at once. For kind thread it may instead be a catalog designation carrying its own pitch: "M2" to "M20" metric coarse, or "#4-40" to "1/2-13" imperial UNC (default M8).',
163
+ },
164
+ rotation: { type: "number" },
165
+ rotationX: { type: "number" },
166
+ rotationZ: { type: "number" },
167
+ sides: { type: "number", description: "Number of flat sides around the axis, at least 3. For cylinder: default 96, which builds a true round cylinder; fewer builds a prism. For pyramid: default 4, a rectangular base; any other count is a regular polygon base. A cone and roundRoof are always round, whatever sides says. For kind revolve/thread: facets per full turn of the sweep, 3-512 (default 64). On a 150 mm ring 64 facets are about 7.4 mm wide and 256 about 1.8 mm; the triangle count grows with it." },
168
+ quality: { type: "number", description: "For kind revolve/thread: how finely curved segments of the profile are sampled, 1-10 (default 6). An outline of [x, z] points is all straight segments, so it changes nothing there; raise sides to smooth the turn." },
169
+ steps: { type: "number", description: "For sphere and halfSphere: display mesh segments around and over the surface (at least 4, default 32). The measured and exported solid is a true curved surface whatever steps says." },
170
+ bevel: {
171
+ type: "number",
172
+ description: "For tube and ring: wall thickness in mm, measured inward from the outer radius (default 4). It is clamped to at least 0.1 and at most the smaller outer radius less 0.1, so the bore never closes: on a 20 mm wide tube, any bevel above 9.9 builds a 9.9 mm wall. A 20x20x10 tube with bevel 4 has a 6 mm inner radius. For text: edge rounding in mm (default 0).",
173
+ },
174
+ segments: { type: "number", description: "For text: curve segments per glyph outline (at least 1, default 2)." },
175
+ topRadius: { type: "number", description: "For cone: radius of the top in mm (default 0, a point)." },
176
+ baseRadius: { type: "number", description: "For cone: recorded base radius in mm (default half the width). It does not change the solid: a cone stands on half its width, so set width and depth to size the base." },
177
+ taperTopWidth: { type: "number", description: `For ${TAPER_KINDS.join(", ")} in local mode: footprint width at the top of the extrusion in mm (default width). Other kinds store it, but measuring or exporting a tapered one is refused. An editor ignores it.` },
178
+ taperTopDepth: { type: "number", description: `For ${TAPER_KINDS.join(", ")} in local mode: footprint depth at the top of the extrusion in mm (default depth). Other kinds store it, but measuring or exporting a tapered one is refused. An editor ignores it.` },
179
+ taperBottomWidth: { type: "number", description: `For ${TAPER_KINDS.join(", ")} in local mode: footprint width at the bottom of the extrusion in mm (default width). Other kinds store it, but measuring or exporting a tapered one is refused. An editor ignores it.` },
180
+ taperBottomDepth: { type: "number", description: `For ${TAPER_KINDS.join(", ")} in local mode: footprint depth at the bottom of the extrusion in mm (default depth). Other kinds store it, but measuring or exporting a tapered one is refused. An editor ignores it.` },
181
+ teeth: { type: "number", description: "For gear: tooth count (default 12)." },
182
+ toothSize: { type: "number", description: "For gear: radial tooth height in mm (default 2.5)." },
183
+ toothWidth: { type: "number", description: "For gear: tooth width in mm (default 0.54 of the tooth pitch, clamped between 0.12 and 0.82 of it)." },
184
+ centerHoleSize: { type: "number", description: "For gear: centre hole size in mm (default 6, clamped so it stays inside the tooth roots; 0 for none)." },
185
+ gearType: { type: "string", enum: ["spur", "helical", "bevel"], description: "For gear: tooth form (default spur)." },
186
+ helixAngle: { type: "number", description: "For gear with gearType helical: helix angle in degrees (default 22.5)." },
187
+ text: { type: "string", description: "For text: the characters to extrude (default TEXT)." },
188
+ font: { type: "string", description: "For text: font name (default Multilanguage)." },
189
+ loftBottomShape: { type: "string", enum: ["Oval", "Rectangle", "Triangle", "Pentagon", "Hexagon"], description: "loft only. Defaults to Rectangle." },
190
+ loftTopShape: { type: "string", enum: ["Oval", "Rectangle", "Triangle", "Pentagon", "Hexagon"], description: "loft only. Defaults to Oval." },
191
+ loftTopWidth: { type: "number", description: "loft only. Independent of the bottom's width, like a cone's top radius. Defaults to matching width." },
192
+ loftTopDepth: { type: "number", description: "loft only. Independent of the bottom's depth. Defaults to matching depth." },
193
+ loftBottomRotation: { type: "number", description: "loft only. Bottom end rotation in degrees." },
194
+ loftTopRotation: { type: "number", description: "loft only. Top end rotation in degrees." },
195
+ loftSegments: { type: "number", description: "loft only. Angular resolution, 8-128." },
196
+ loftLayers: { type: "number", description: "loft only. Vertical resolution, 2-80." },
197
+ },
198
+ },
199
+ },
200
+ {
201
+ name: "sketchforge_import_mesh",
202
+ description: "Import a triangle mesh into SketchForge from raw position and optional normal arrays.",
203
+ inputSchema: {
204
+ ...editorTargetSchema,
205
+ required: ["positions"],
206
+ properties: {
207
+ ...editorTargetSchema.properties,
208
+ name: { type: "string" },
209
+ color: { type: "string" },
210
+ x: { type: "number" },
211
+ z: { type: "number" },
212
+ elevation: { type: "number" },
213
+ width: { type: "number" },
214
+ depth: { type: "number" },
215
+ height: { type: "number" },
216
+ positions: { type: "array", items: { type: "number" } },
217
+ normals: { type: "array", items: { type: "number" } },
218
+ },
219
+ },
220
+ },
221
+ {
222
+ name: "sketchforge_import_file",
223
+ description: "Import an STL, OBJ, or SVG file from the MCP host filesystem into SketchForge. The source filename supplies the shape name; color and placement use importer defaults. In local mode provide projectId and filePath; with url, the file is sent to POST /api/v1/imports. File reads are confined to SKETCHFORGE_MCP_FILES_DIR, or SKETCHFORGE_PROJECTS_DIR when unset; if both are unset, paths are unrestricted.",
224
+ inputSchema: {
225
+ type: "object",
226
+ required: ["projectId", "filePath"],
227
+ properties: {
228
+ url: editorTargetSchema.properties.url,
229
+ projectId: { type: "string" },
230
+ filePath: { type: "string", description: "Path to an .stl, .obj, or .svg file under the configured MCP files root; unrestricted when no root is set." },
231
+ },
232
+ },
233
+ },
234
+ {
235
+ name: "sketchforge_import_stl",
236
+ description: "Local-only compatibility alias for sketchforge_import_file. Accepts STL, OBJ, or SVG files. Optional name, color, and placement fields override the imported shape. A remote url is not supported.",
237
+ inputSchema: {
238
+ type: "object",
239
+ required: ["projectId", "filePath"],
240
+ properties: {
241
+ projectId: { type: "string" },
242
+ filePath: { type: "string", description: "Path to an .stl, .obj, or .svg file under the configured MCP files root; unrestricted when no root is set." },
243
+ name: { type: "string" },
244
+ color: { type: "string" },
245
+ x: { type: "number" },
246
+ z: { type: "number" },
247
+ elevation: { type: "number" },
248
+ },
249
+ },
250
+ },
251
+ {
252
+ name: "sketchforge_update_object",
253
+ description: "Update one object's exact dimensions, position, color, name, hole state, or rotations.",
254
+ inputSchema: {
255
+ ...editorTargetSchema,
256
+ required: ["id"],
257
+ properties: {
258
+ ...editorTargetSchema.properties,
259
+ id: { type: "string" },
260
+ name: { type: "string" },
261
+ color: { type: "string" },
262
+ faceColors: { type: "object", description: "Optional colors keyed by stable face IDs from sketchforge_list_faces, such as {'face_abc':'#ff0000'}. Numeric face indexes remain accepted for older projects." },
263
+ hole: { type: "boolean" },
264
+ x: { type: "number" },
265
+ z: { type: "number" },
266
+ elevation: { type: "number" },
267
+ width: { type: "number" },
268
+ depth: { type: "number" },
269
+ height: { type: "number" },
270
+ size: { type: "number" },
271
+ rotation: { type: "number" },
272
+ rotationX: { type: "number" },
273
+ rotationZ: { type: "number" },
274
+ },
275
+ },
276
+ },
277
+ {
278
+ name: "sketchforge_pattern_objects",
279
+ description: "Repeat SketchForge objects in a row or around a ring, the way the editor's Repeat panel does. Makes the copies; sketchforge_distribute_objects only re-spaces objects that already exist.",
280
+ inputSchema: {
281
+ ...editorTargetSchema,
282
+ properties: {
283
+ ...editorTargetSchema.properties,
284
+ ids: { type: "array", items: { type: "string" }, description: "Object ids to repeat. If omitted, uses the current selection." },
285
+ kind: { type: "string", enum: ["linear", "circular"], description: "linear=a row; circular=a ring about a centre. Default linear." },
286
+ count: { type: "number", description: "Total copies including the original, so 4 adds 3 (2-200). Default 4." },
287
+ stepX: { type: "number", description: "For kind linear: centre-to-centre step along X in mm. This is a pitch, not a gap." },
288
+ stepZ: { type: "number", description: "For kind linear: centre-to-centre step along Z in mm." },
289
+ centerX: { type: "number", description: "For kind circular: X of the point to turn about." },
290
+ centerZ: { type: "number", description: "For kind circular: Z of the point to turn about." },
291
+ sweepAngle: { type: "number", description: "For kind circular: how far round to spread the copies, in degrees. 360 divides evenly so the last does not land on the first; a partial sweep puts one copy at each end. Default 360." },
292
+ rotateCopies: { type: "boolean", description: "For kind circular: whether each copy turns to follow the ring (default true). A spoke or vane needs it; a bolt hole does not." },
293
+ },
294
+ },
295
+ },
296
+ {
297
+ name: "sketchforge_distribute_objects",
298
+ description: "Spread three or more SketchForge objects evenly along an axis, the way the editor's Distribute buttons do. The outermost two keep their places and define the span.",
299
+ inputSchema: {
300
+ ...editorTargetSchema,
301
+ properties: {
302
+ ...editorTargetSchema.properties,
303
+ ids: { type: "array", items: { type: "string" }, description: "Object ids to distribute. If omitted, uses the current selection." },
304
+ axis: { type: "string", enum: ["x", "z"], description: "Axis to spread along. Omit to use whichever axis the objects are already most spread along." },
305
+ spacing: { type: "string", enum: ["gaps", "centers"], description: "gaps=equal clear space between objects (default); centers=equal centre-to-centre pitch." },
306
+ },
307
+ },
308
+ },
309
+ {
310
+ name: "sketchforge_align_objects",
311
+ description: "Align two or more SketchForge objects using the same alignment logic as the editor Alignment button.",
312
+ inputSchema: {
313
+ ...editorTargetSchema,
314
+ required: ["axis", "target"],
315
+ properties: {
316
+ ...editorTargetSchema.properties,
317
+ ids: { type: "array", items: { type: "string" }, description: "Object ids to align. If omitted, uses the current selection." },
318
+ anchorId: { type: "string", description: "Optional object id to keep fixed as the alignment reference." },
319
+ axis: { type: "string", enum: ["x", "y", "z"], description: "x=left/right, z=front/back, y=bottom/top." },
320
+ target: { type: "string", enum: ["min", "center", "max"], description: "Which side/center to align." },
321
+ },
322
+ },
323
+ },
324
+ {
325
+ name: "sketchforge_group_objects",
326
+ description: "Group objects by id using SketchForge's normal grouping/boolean pipeline. A selection holding a hole comes back cut. Optional name and color are set on the result.",
327
+ inputSchema: {
328
+ ...editorTargetSchema,
329
+ required: ["ids"],
330
+ properties: {
331
+ ...editorTargetSchema.properties,
332
+ ids: { type: "array", items: { type: "string" } },
333
+ ...resultAttributeProperties,
334
+ },
335
+ },
336
+ },
337
+ {
338
+ name: "sketchforge_ungroup_objects",
339
+ description: "Ungroup one or more grouped objects by id and preserve their edited geometry.",
340
+ inputSchema: {
341
+ ...editorTargetSchema,
342
+ properties: {
343
+ ...editorTargetSchema.properties,
344
+ ids: { type: "array", items: { type: "string" } },
345
+ id: { type: "string" },
346
+ },
347
+ },
348
+ },
349
+ {
350
+ name: "sketchforge_boolean_cut",
351
+ description: "Cut solids with hole objects. Provide solidIds and holeIds; the result replaces the operands. Optional name and color are set on the result.",
352
+ inputSchema: {
353
+ ...editorTargetSchema,
354
+ required: ["solidIds", "holeIds"],
355
+ properties: {
356
+ ...editorTargetSchema.properties,
357
+ solidIds: { type: "array", items: { type: "string" } },
358
+ holeIds: { type: "array", items: { type: "string" } },
359
+ ...resultAttributeProperties,
360
+ },
361
+ },
362
+ },
363
+ {
364
+ name: "sketchforge_separate_parts",
365
+ description: "Separate one disconnected multi-part object into independent objects.",
366
+ inputSchema: {
367
+ ...editorTargetSchema,
368
+ properties: {
369
+ ...editorTargetSchema.properties,
370
+ id: { type: "string" },
371
+ },
372
+ },
373
+ },
374
+ {
375
+ name: "sketchforge_explode_step_assembly",
376
+ description: "Explode an imported STEP assembly into independent exact solids. Limited to 200 solids and 8 MiB source files.",
377
+ inputSchema: { ...editorTargetSchema, required: ["projectId", "shapeId"], properties: { ...editorTargetSchema.properties, projectId: { type: "string" }, shapeId: { type: "string" } } },
378
+ },
379
+ {
380
+ name: "sketchforge_list_edges",
381
+ description: "List real CAD edge ids for one object so a later chamfer/fillet can target specific edges.",
382
+ inputSchema: {
383
+ ...editorTargetSchema,
384
+ required: ["id"],
385
+ properties: {
386
+ ...editorTargetSchema.properties,
387
+ id: { type: "string" },
388
+ sharpAngle: { type: "number" },
389
+ },
390
+ },
391
+ },
392
+ {
393
+ name: "sketchforge_apply_edge_treatment",
394
+ description: "Apply chamfer or fillet to specific edge ids returned by sketchforge_list_edges.",
395
+ inputSchema: {
396
+ ...editorTargetSchema,
397
+ required: ["id", "kind", "edgeIds", "amount"],
398
+ properties: {
399
+ ...editorTargetSchema.properties,
400
+ id: { type: "string" },
401
+ kind: { type: "string", enum: ["chamfer", "fillet"] },
402
+ edgeIds: {
403
+ anyOf: [
404
+ { type: "array", items: { type: "number" } },
405
+ { type: "string", enum: ["all"] },
406
+ ],
407
+ },
408
+ allEdges: { type: "boolean" },
409
+ amount: { type: "number" },
410
+ chamferAngle: { type: "number" },
411
+ sharpAngle: { type: "number" },
412
+ quality: { type: "string", enum: ["draft", "standard", "fine"] },
413
+ preserveEdgeSize: { type: "boolean" },
414
+ },
415
+ },
416
+ },
417
+ {
418
+ name: "sketchforge_inspect_errors",
419
+ description: "Inspect the editor notice, last MCP error, and active edge modifier error.",
420
+ inputSchema: editorTargetSchema,
421
+ },
422
+ {
423
+ name: "sketchforge_capture_image",
424
+ description: "Capture a PNG image from current/home/top/bottom/front/back/right/left view. Editor mode captures the live viewport. Local project mode rasterises the kernel's hidden-line drawing of the stored geometry: a named face is that one view, home and current are the four-view grid. Prefer sketchforge_project_view for the SVG itself.",
425
+ inputSchema: {
426
+ ...editorTargetSchema,
427
+ properties: {
428
+ ...editorTargetSchema.properties,
429
+ face: { type: "string", enum: ["current", "home", "top", "bottom", "front", "back", "right", "left"] },
430
+ featureAngle: { type: "number", minimum: 0, maximum: 180, description: "Crease angle in degrees for mesh shapes (imported, mesh-derived, boolean results): an edge between two triangles is drawn only where they meet at more than this, besides boundaries and silhouettes. Default 30; 0 draws every edge that is not flat. Exact solids ignore it. Local project mode only; the live editor viewport ignores it." },
431
+ },
432
+ },
433
+ },
434
+ {
435
+ name: "sketchforge_export_scene",
436
+ description: "Export selected objects or the whole scene as STL, OBJ, 3MF, STEP, SKF, a ZIP kit, SVG drawings, or section DXF. DXF needs section {plane, offset}. Set outputPath to save on the MCP host; writes are confined to SKETCHFORGE_MCP_FILES_DIR, or SKETCHFORGE_PROJECTS_DIR when unset. If both are unset, paths are unrestricted. Existing files require overwrite: true.",
437
+ inputSchema: { ...editorTargetSchema, required: ["format"], properties: { ...editorTargetSchema.properties, format: { type: "string", enum: ["stl", "obj", "3mf", "step", "skf", "zip", "svg", "dxf"] }, view: { type: "string", enum: PROJECTION_LAYOUTS, description: "For svg only: one named view, or the multiview grid (default)." }, section: { type: "object", description: "For svg or dxf section export.", properties: { plane: { type: "string", enum: ["xy", "xz", "yz"] }, offset: { type: "number" } }, required: ["plane", "offset"] }, shapeIds: { type: "array", items: { type: "string" }, description: "Optional object ids." }, name: { type: "string" }, outputPath: { type: "string", description: "Destination path under SKETCHFORGE_MCP_FILES_DIR (or SKETCHFORGE_PROJECTS_DIR when unset); unrestricted if neither is set." }, overwrite: { type: "boolean", description: "Set true to replace an existing output file." } } },
438
+ },
439
+ {
440
+ name: "sketchforge_project_view",
441
+ description: "Draw a stored project as an SVG by the CAD kernel's hidden-line removal: true curves, hidden edges dashed, a gnomon per view and the overall size. Mesh shapes are drawn by feature edges (see featureAngle), silhouettes and boundaries rather than every triangle. The multiview grid (front, top, right, iso) is the readable picture of the geometry; a single view is a 2D drawing of that face. Works offline or against a server when url is supplied.",
442
+ inputSchema: {
443
+ type: "object",
444
+ required: ["projectId"],
445
+ properties: {
446
+ url: { type: "string", description: "Optional SketchForge server URL. Omit to work offline with local project files." },
447
+ projectId: { type: "string", description: "The server-side project id." },
448
+ view: { type: "string", enum: PROJECTION_LAYOUTS, description: "One named view, or the multiview grid (default)." },
449
+ featureAngle: { type: "number", minimum: 0, maximum: 180, description: "Crease angle in degrees for mesh shapes (imported, mesh-derived, boolean results): an edge between two triangles is drawn only where they meet at more than this, besides boundaries and silhouettes. Default 30; 0 draws every edge that is not flat. Exact solids ignore it." },
450
+ shapeIds: { type: "array", items: { type: "string" }, description: "Optional object ids; defaults to the current selection, or the whole scene when nothing is selected." },
451
+ name: { type: "string", description: "Optional base name for the file." },
452
+ outputPath: { type: "string", description: "Optional destination path under SKETCHFORGE_MCP_FILES_DIR (or SKETCHFORGE_PROJECTS_DIR when unset); unrestricted if neither is set. SVG text is returned inline otherwise." },
453
+ overwrite: { type: "boolean", description: "Set true to replace an existing output file." },
454
+ },
455
+ },
456
+ },
457
+ {
458
+ name: "sketchforge_section_view",
459
+ description: "Return a CAD section drawing as SVG by cutting the stored solids with one axis-aligned plane in drawing coordinates. offset is the coordinate of the omitted axis, in millimetres. Exact shapes are cut by the OCCT kernel; mesh shapes (imported STL/OBJ and other mesh-backed shapes) are sliced directly, up to 2,000,000 triangles across the selection -- pass shapeIds to section fewer shapes when over that. Works offline or against a server when url is supplied.",
460
+ inputSchema: {
461
+ type: "object",
462
+ required: ["projectId", "plane", "offset"],
463
+ properties: {
464
+ url: { type: "string", description: "Optional SketchForge server URL. Omit to work offline with local project files." },
465
+ projectId: { type: "string", description: "The project id." },
466
+ plane: { type: "string", enum: SECTION_PLANES, description: "Plane in drawing coordinates; XY omits Z, XZ omits Y, and YZ omits X." },
467
+ offset: { type: "number", description: "Coordinate of the omitted axis in millimetres; must intersect the selected scene." },
468
+ shapeIds: { type: "array", items: { type: "string" }, description: "Optional object ids; defaults to the current selection, or the whole scene when nothing is selected." },
469
+ name: { type: "string", description: "Optional base name for the file." },
470
+ outputPath: { type: "string", description: "Optional destination path under SKETCHFORGE_MCP_FILES_DIR (or SKETCHFORGE_PROJECTS_DIR when unset); unrestricted if neither is set. SVG text is returned inline otherwise." },
471
+ overwrite: { type: "boolean", description: "Set true to replace an existing output file." },
472
+ },
473
+ },
474
+ },
475
+ {
476
+ name: "sketchforge_validate_scene",
477
+ description: "Check triangle topology, conservative AABB clearance bounds, and exact Manifold intersection volumes for overlapping scene objects.",
478
+ inputSchema: { ...editorTargetSchema, properties: { ...editorTargetSchema.properties, shapeIds: { type: "array", items: { type: "string" } }, excludeShapeIds: { type: "array", items: { type: "string" } } } },
479
+ },
480
+ {
481
+ name: "sketchforge_check_interference",
482
+ description: "Check exact OCCT surface gaps and overlap volumes between visible, non-cutter solids. Clearance is in millimetres. The report refuses the whole request above 128 shapes or 512 AABB candidate pairs; narrow ids or reduce clearance. Works offline or against a server.",
483
+ inputSchema: { ...editorTargetSchema, properties: { ...editorTargetSchema.properties, ids: { type: "array", items: { type: "string" }, description: "Optional shape ids; defaults to all visible non-cutter solids." }, clearance: { type: "number", minimum: 0, description: "Maximum exact surface gap to report, in mm (default 0)." } } },
484
+ },
485
+ // CAD operations use the local engine by default and the server API when a URL is supplied.
486
+ {
487
+ name: "sketchforge_list_faces",
488
+ description: "List a stored project shape's CAD faces with stable IDs and compatibility indexes, plus the direction name each one can be opened by. Use the stable ID to assign a face color; use the index for treatments, measurements, and shell openings. Works offline or against a server when url is supplied.",
489
+ inputSchema: {
490
+ type: "object",
491
+ required: ["projectId", "shapeId"],
492
+ properties: {
493
+ url: { type: "string", description: "Optional SketchForge server URL. Omit to work offline with local project files." },
494
+ projectId: { type: "string", description: "The server-side project id." },
495
+ shapeId: { type: "string", description: "The id of the shape to read." },
496
+ },
497
+ },
498
+ },
499
+ // Measuring uses exact CAD geometry in either the local engine or server API.
500
+ {
501
+ name: "sketchforge_measure_shape",
502
+ description: "Measure every edge and face of a stored project shape from its exact CAD geometry: edge length, the radius and diameter of a circular edge or arc, face area, and a cylindrical face's radius. Exact (OCCT), so a round hole has a real radius rather than the chord length of a facet. A measurement that is not meaningful for the entity -- the radius of a straight edge, of an ellipse, or of a cone whose radius changes along it -- comes back null with a reason in radiusUnavailable. Works offline or against a server when url is supplied.",
503
+ inputSchema: {
504
+ type: "object",
505
+ required: ["projectId", "shapeId"],
506
+ properties: {
507
+ url: { type: "string", description: "Optional SketchForge server URL. Omit to work offline with local project files." },
508
+ projectId: { type: "string", description: "The server-side project id." },
509
+ shapeId: { type: "string", description: "The id of the shape to measure." },
510
+ },
511
+ },
512
+ },
513
+ {
514
+ name: "sketchforge_measure_between",
515
+ description: "The exact minimum distance between two CAD entities in a stored project, and the angle between them when both are flat faces. Each end names a shape and either the whole solid, or one edge or face by the index the measurement listing gave it. Distance is measured between the real surfaces where the shapes sit, so two round posts 5mm apart at their nearest walls read 5 -- not the gap between their bounding boxes. Works offline or against a server when url is supplied.",
516
+ inputSchema: {
517
+ type: "object",
518
+ required: ["projectId", "from", "to"],
519
+ properties: {
520
+ url: { type: "string", description: "Optional SketchForge server URL. Omit to work offline with local project files." },
521
+ projectId: { type: "string", description: "The server-side project id." },
522
+ from: {
523
+ type: "object",
524
+ required: ["shapeId"],
525
+ properties: {
526
+ shapeId: { type: "string", description: "The shape this end is part of." },
527
+ entity: {
528
+ type: "string",
529
+ enum: ["shape", "edge", "face"],
530
+ description: "What to measure to. 'shape' is the whole solid and takes no index; 'edge' and 'face' need one.",
531
+ },
532
+ index: { type: "number", description: "Which edge or face, by the index the measurement listing gave it." },
533
+ },
534
+ },
535
+ to: {
536
+ type: "object",
537
+ required: ["shapeId"],
538
+ properties: {
539
+ shapeId: { type: "string", description: "The shape this end is part of." },
540
+ entity: { type: "string", enum: ["shape", "edge", "face"] },
541
+ index: { type: "number" },
542
+ },
543
+ },
544
+ },
545
+ },
546
+ },
547
+ {
548
+ name: "sketchforge_shape_properties",
549
+ description: "Read one stored shape's volume, surface area, center of mass, bounds and validity, with provenance identifying the geometry source and whether precision is exact or tessellated. A group of solids is measured as the union of its children. Exact shapes are measured by the CAD kernel; closed mesh-sourced shapes are measured directly from their triangles, counting every shell and subtracting enclosed voids, and a mesh that does not close is left to the kernel, which refuses it. Works offline or against a server when url is supplied.",
550
+ inputSchema: {
551
+ type: "object",
552
+ required: ["projectId", "shapeId"],
553
+ properties: {
554
+ url: { type: "string", description: "Optional SketchForge server URL. Omit to work offline with local project files." },
555
+ projectId: { type: "string", description: "The project id." },
556
+ shapeId: { type: "string", description: "The shape id." },
557
+ },
558
+ },
559
+ },
560
+ {
561
+ name: "sketchforge_estimate_wall_thickness",
562
+ description: "Estimate wall thickness from a 5 by 5 UV sample grid on each face. This is a screening estimate and may miss thin regions between samples; it is not a certified minimum-thickness result.",
563
+ inputSchema: { type: "object", required: ["projectId", "shapeId"], properties: { url: { type: "string" }, projectId: { type: "string" }, shapeId: { type: "string" } } },
564
+ },
565
+ {
566
+ name: "sketchforge_hollow_shape",
567
+ description: "Hollow a stored project shape out to a wall of a given thickness, optionally leaving faces open so a box becomes a tray. Exact (OCCT), so the result still exports to STEP and can still be filleted. A sphere, torus, cone or round-walled tube cannot be hollowed at any thickness. Works offline or against a server when url is supplied.",
568
+ inputSchema: {
569
+ type: "object",
570
+ required: ["projectId", "shapeId", "thickness"],
571
+ properties: {
572
+ url: { type: "string", description: "Optional SketchForge server URL. Omit to work offline with local project files." },
573
+ projectId: { type: "string", description: "The server-side project id." },
574
+ shapeId: { type: "string", description: "The id of the shape to hollow." },
575
+ thickness: { type: "number", description: "Wall thickness in mm, measured inwards. Must be well under half the part's smallest span." },
576
+ openFaces: {
577
+ type: "array",
578
+ description: 'Faces to leave open. Direction names ("top", "bottom", "left", "right", "front", "back") or face indexes from sketchforge_list_faces. Omit for a sealed hollow.',
579
+ items: { type: ["string", "number"] },
580
+ },
581
+ },
582
+ },
583
+ },
584
+ {
585
+ name: "sketchforge_list_parameters",
586
+ description: `List the project's named parameters: name, expression, dimension, resolved value (null for a stale entry) and error, if any. bindingIssues lists shape bindings that no longer resolve. ${REFUSAL_FORMAT} ${WORKS_BOTH_WAYS}`,
587
+ inputSchema: {
588
+ type: "object",
589
+ required: ["projectId"],
590
+ properties: { url: urlProperty, projectId: projectIdProperty },
591
+ },
592
+ },
593
+ {
594
+ name: "sketchforge_set_parameter",
595
+ description: [
596
+ "Create a parameter, or change the expression or dimension of an existing one.",
597
+ "Send expression and dimension to create. An existing name is overwritten, not refused; created says which happened. Either one alone changes an existing parameter.",
598
+ "A bare number takes the dimension's unit, so 3 in a length parameter is 3 mm.",
599
+ "The reply has created, the parameter, the whole table, and the shapes the change rebuilt.",
600
+ REFUSAL_FORMAT,
601
+ "Codes: invalid_expression (bad syntax, an unknown name, the wrong dimension or a cycle; expressionError has the span and any cycle path), parameter_not_found (a change to a name that does not exist), invalid_request (a bad name or dimension, or an empty or over-long expression), limit_exceeded (the table is full), shape_locked (a bound shape is locked; detail names shapeId and fields), geometry_failed (a bound sketch cannot be solved; detail names shapeId and constraintIds).",
602
+ WORKS_BOTH_WAYS,
603
+ ].join(" "),
604
+ inputSchema: {
605
+ type: "object",
606
+ required: ["projectId", "name"],
607
+ properties: {
608
+ url: urlProperty,
609
+ projectId: projectIdProperty,
610
+ name: { type: "string", description: "Parameter name: a letter or underscore, then letters, digits or underscores." },
611
+ expression: { type: "string", description: 'For example "2", "3 mm", "wall * 2 + 1" or "max(wall, 2)". Units: mm, cm, m, in, ft, deg, rad.' },
612
+ dimension: { type: "string", enum: PARAMETER_DIMENSIONS, description: "length values are in mm and angle values in degrees." },
613
+ },
614
+ },
615
+ },
616
+ {
617
+ name: "sketchforge_rename_parameter",
618
+ description: `Rename a parameter, rewriting every parameter expression and shape binding that uses it. ${REFUSAL_FORMAT} Codes: parameter_not_found, parameter_exists (newName is taken), invalid_request (newName is not a valid name). ${WORKS_BOTH_WAYS}`,
619
+ inputSchema: {
620
+ type: "object",
621
+ required: ["projectId", "name", "newName"],
622
+ properties: {
623
+ url: urlProperty,
624
+ projectId: projectIdProperty,
625
+ name: { type: "string", description: "The current name." },
626
+ newName: { type: "string", description: "The new name." },
627
+ },
628
+ },
629
+ },
630
+ {
631
+ name: "sketchforge_delete_parameter",
632
+ description: `Delete a parameter that nothing uses. ${REFUSAL_FORMAT} Codes: parameter_not_found; parameter_in_use while anything references it, with dependents (parameter names), shapeDependents (shapeId and fields), sketchConstraintDependents (shapeId and constraintIds) and configurationDependents (configuration names) to change or clear first. ${WORKS_BOTH_WAYS}`,
633
+ inputSchema: {
634
+ type: "object",
635
+ required: ["projectId", "name"],
636
+ properties: { url: urlProperty, projectId: projectIdProperty, name: { type: "string", description: "The parameter to delete." } },
637
+ },
638
+ },
639
+ {
640
+ name: "sketchforge_set_shape_expression",
641
+ description: [
642
+ "Bind one field of a stored shape to a parameter expression and apply its value, or pass expression null to clear the binding and keep the current number.",
643
+ "A changed parameter then rebuilds the shape. Bindable fields: x, z, elevation, width, depth, height, rotation, rotationX, rotationZ, kind parameters such as sides or bevel, revolve.startAngle, revolve.sweepAngle and the other revolve settings, draftPrismAngle and faceDraft.angle.",
644
+ "The reply has the shape, as GET /api/v1/shapes reports it, and the revision. Repeating the stored expression writes nothing.",
645
+ REFUSAL_FORMAT,
646
+ "Codes: unapplicable_fields (this shape cannot bind the field), invalid_expression (detail names shapeId and field, with expressionError, or value, min and max for a result out of range), shape_not_found, shape_locked (detail names shapeId and fields).",
647
+ WORKS_BOTH_WAYS,
648
+ ].join(" "),
649
+ inputSchema: {
650
+ type: "object",
651
+ required: ["projectId", "shapeId", "field", "expression"],
652
+ properties: {
653
+ url: urlProperty,
654
+ projectId: projectIdProperty,
655
+ shapeId: { type: "string", description: "The shape id." },
656
+ field: { type: "string", description: 'The field to bind, such as "width" or "revolve.sweepAngle".' },
657
+ expression: { type: ["string", "null"], description: 'For example "wall * 5". null clears the binding.' },
658
+ },
659
+ },
660
+ },
661
+ {
662
+ name: "sketchforge_bind_sketch_constraint",
663
+ description: [
664
+ "Bind one dimensional constraint of a stored shape's sketch (distance, radius, diameter or angle) to a parameter expression, re-solve the sketch and rebuild the shape; or pass expression null to unbind it and keep its value.",
665
+ "A changed parameter then re-solves the sketch. shapeId is the sketch output or its sketchSourceId.",
666
+ "The reply has the rebuilt shape, as GET /api/v1/shapes reports it, the constraint as { id, kind, value, expression }, and the revision.",
667
+ REFUSAL_FORMAT,
668
+ "Codes: invalid_expression (bad syntax, an unknown name, the wrong dimension, or outOfRange; detail names shapeId and constraintId), unapplicable_fields (the constraint cannot bind, the sketch cannot be rebuilt, or conflictingBinding: a bound size of the same output drives that dimension; detail lists those fields), invalid_request (constraintId missing or unknown, or a bad body), geometry_failed (the sketch cannot be solved; detail lists constraintIds), shape_not_found, invalid_shape_id (shapeId missing or blank), shape_locked (detail shapeId names the locked shape or the locked group holding it; when that one is nested, the sentence names the top-level group to ungroup).",
669
+ WORKS_BOTH_WAYS,
670
+ ].join(" "),
671
+ inputSchema: {
672
+ type: "object",
673
+ required: ["projectId", "shapeId", "constraintId", "expression"],
674
+ properties: {
675
+ url: urlProperty,
676
+ projectId: projectIdProperty,
677
+ shapeId: { type: "string", description: "The sketch output shape, or its sketchSourceId." },
678
+ constraintId: { type: "string", description: 'The constraint id in the sketch profile, such as "width".' },
679
+ expression: { type: ["string", "null"], description: 'For example "w * 2". null removes the binding.' },
680
+ },
681
+ },
682
+ },
683
+ {
684
+ name: "sketchforge_list_parameter_configurations",
685
+ description: `List the project's parameter configurations: named sets of parameter expression overrides. The reply has configurations, activeConfiguration (null for the base table), the parameter table as the active configuration resolves it, and issues for overrides that no longer resolve. ${REFUSAL_FORMAT} ${WORKS_BOTH_WAYS}`,
686
+ inputSchema: { type: "object", required: ["projectId"], properties: { url: urlProperty, projectId: projectIdProperty } },
687
+ },
688
+ {
689
+ name: "sketchforge_create_parameter_configuration",
690
+ description: [
691
+ "Create a parameter configuration, optionally with overrides that map parameter names to expressions. Creating one does not activate it.",
692
+ "The reply has the configuration and the whole configuration state.",
693
+ REFUSAL_FORMAT,
694
+ "Codes: configuration_exists, invalid_request (a bad name or overrides body), invalid_expression (an override that does not resolve; detail names parameter and configuration), parameter_not_found (an override for a parameter that does not exist), limit_exceeded.",
695
+ WORKS_BOTH_WAYS,
696
+ ].join(" "),
697
+ inputSchema: {
698
+ type: "object",
699
+ required: ["projectId", "name"],
700
+ properties: {
701
+ url: urlProperty,
702
+ projectId: projectIdProperty,
703
+ name: { type: "string", description: "The configuration name, 1 to 100 characters." },
704
+ overrides: { type: "object", additionalProperties: { type: "string" }, description: 'Parameter name to expression, for example { "wall": "3 mm" }.' },
705
+ },
706
+ },
707
+ },
708
+ {
709
+ name: "sketchforge_rename_parameter_configuration",
710
+ description: `Rename a parameter configuration; an active one stays active under its new name. ${REFUSAL_FORMAT} Codes: configuration_not_found, configuration_exists (newName is taken), invalid_request. ${WORKS_BOTH_WAYS}`,
711
+ inputSchema: {
712
+ type: "object",
713
+ required: ["projectId", "name", "newName"],
714
+ properties: { url: urlProperty, projectId: projectIdProperty, name: { type: "string", description: "The configuration name, 1 to 100 characters." }, newName: { type: "string", description: "The configuration name, 1 to 100 characters." } },
715
+ },
716
+ },
717
+ {
718
+ name: "sketchforge_set_configuration_override",
719
+ description: [
720
+ "Set one parameter's expression in a configuration, or pass expression null to remove that override so the base expression applies.",
721
+ "If the configuration is active, every shape bound to the changed value is rebuilt in the same write and returned in the reply's shapes.",
722
+ REFUSAL_FORMAT,
723
+ "Codes: configuration_not_found, parameter_not_found, invalid_expression (detail has expressionError), shape_locked (a bound shape the change would rebuild is locked), invalid_request.",
724
+ WORKS_BOTH_WAYS,
725
+ ].join(" "),
726
+ inputSchema: {
727
+ type: "object",
728
+ required: ["projectId", "name", "parameter", "expression"],
729
+ properties: {
730
+ url: urlProperty,
731
+ projectId: projectIdProperty,
732
+ name: { type: "string", description: "The configuration name, 1 to 100 characters." },
733
+ parameter: { type: "string", description: "The parameter to override." },
734
+ expression: { type: ["string", "null"], description: 'For example "3 mm". null removes the override.' },
735
+ },
736
+ },
737
+ },
738
+ {
739
+ name: "sketchforge_delete_parameter_configuration",
740
+ description: `Delete a parameter configuration. Deleting the active one returns the project to the base table and rebuilds bound shapes, so it can be refused as an activation can. ${REFUSAL_FORMAT} Codes: configuration_not_found, invalid_request, and for the active one invalid_expression (a bound result out of range), shape_locked (a bound shape that would change is locked) and geometry_failed (a bound sketch cannot be solved). ${WORKS_BOTH_WAYS}`,
741
+ inputSchema: { type: "object", required: ["projectId", "name"], properties: { url: urlProperty, projectId: projectIdProperty, name: { type: "string", description: "The configuration name, 1 to 100 characters." } } },
742
+ },
743
+ {
744
+ name: "sketchforge_activate_parameter_configuration",
745
+ description: [
746
+ "Activate a parameter configuration, or pass name null to return to the base table. Every bound shape is re-resolved and rebuilt in the same write, and the reply lists the rebuilt shapes.",
747
+ "A refused activation leaves the project, the active configuration and the geometry unchanged.",
748
+ REFUSAL_FORMAT,
749
+ "Codes: configuration_not_found, invalid_expression (an override, or a bound result such as an out-of-range size; detail names it), shape_locked (a bound shape that would change is locked), geometry_failed (a bound sketch cannot be solved), invalid_request.",
750
+ WORKS_BOTH_WAYS,
751
+ ].join(" "),
752
+ inputSchema: {
753
+ type: "object",
754
+ required: ["projectId", "name"],
755
+ properties: { url: urlProperty, projectId: projectIdProperty, name: { type: ["string", "null"], description: "The configuration to activate, or null for the base table." } },
756
+ },
757
+ },
758
+ ];