Skip to main content
Glama

Add Surface

add_surface

Use this when you need to author a NURBS Surface into the user's .kcad.ts. One authoring path, selected by kind:

  • 'nurbs' — insert a nurbsSurface(...) / surfaceFromCurves(...) call. Pass either { controls, degree, weights?, knots?, periodic? } for direct construction, OR { section_sketch_ids } for skinning. Slice-1 limitation: weights are accepted but currently ignored (TColStd_Array2OfReal not exposed in WASM bindings); surfaces are non-rational.

  • 'boundary' — insert a surfaceFromBoundary([c1,c2,c3,c4], opts?) call: one NURBS face through 4 boundary Curve3D refs (bottom, right, top, left in loop order; adjacent endpoints must coincide within 1e-6 mm) via OCCT BRepOffsetAPI_MakeFilling. The returned Surface produces no Shape until you chain .thicken(t) or .toShape() (do that via add_feature on the binding name). Returns the modified code + diagnostics. Each kind fails closed on its own missing required params.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesCurrent .kcad.ts source.
kindYesWhich surface-construction path to use.
knotsNokind:'nurbs' — optional explicit knot vectors; missing => clamped uniform inferred.
degreeNokind:'nurbs' — degrees in U and V; each in [1, nU-1] / [1, nV-1].
weightsNokind:'nurbs' — optional rational weights, same grid shape as controls. Ignored in slice-1.
controlsNokind:'nurbs' — control-point grid for direct construction (controls[u][v] = [x, y, z], mm).
periodicNokind:'nurbs' — optional periodic flags per parametric direction.
samplingNokind:'boundary' — OCCT NbPtsOnCur sampling parameter (default 15).
continuityNokind:'boundary' — continuity grade applied to every edge ('C0' | 'C1' | 'C2'), or an array of 4 grades (one per edge, bottom/right/top/left order). Default 'C0'.
binding_nameNoJS const name for the new Surface binding (kind:'nurbs' default surface_<N>; kind:'boundary' default _surface_<N>).
curve_bindingsNokind:'boundary' — tuple of 4 existing Curve3D variable names (bottom, right, top, left) declared earlier in the source.
section_sketch_idsNokind:'nurbs' — existing sketch FeatureIds (2 or more) to skin a surface through, in order.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesWhether the edit applied and re-evaluated cleanly.
errorNoFailure message (present when ok is false).
new_codeNoModified .kcad.ts source (present on success). Caller persists it.
diagnosticsNoDiagnostics from re-evaluating the modified source.
binding_nameNoJS const name bound to the new construct (when one was created).

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations (readOnlyHint=false, destructiveHint=false) indicate mutation without destruction. Description adds crucial details: slice-1 limitation (weights ignored), surfaces are non-rational, no Shape until chaining .thicken() or .toShape(), returns code + diagnostics, and each kind fails closed on missing params. This far exceeds annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-organized with a clear lead sentence and separate paragraphs for each kind. It is fairly long but each sentence adds information. Slightly verbose but not redundant; earns its length.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 12 parameters, two modes, nested objects, and an output schema, the description covers prerequisites, limitations, behavioral nuances, and post-creation steps. It mentions the need for declared curve_bindings and the chaining with add_feature, leaving no major gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with each parameter described. Description adds significant value by grouping parameters by kind, explaining defaults (knots, sampling, continuity), constraints (adjacent endpoints must coincide within 1e-6 mm), and side effects (ignored weights). It also clarifies the control-point grid shape and curve_bindings order.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool authors NURBS surfaces with two distinct paths selected by 'kind'. It specifies the exact function calls generated (nurbsSurface, surfaceFromCurves, surfaceFromBoundary) and differentiates from sibling tools like add_curve or add_feature by focusing on surface creation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description opens with 'Use this when you need to author a NURBS Surface' providing clear context. It explains each kind's sub-usage but does not explicitly list when not to use or alternative tools, though the specificity implies limited applicability.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A3.9/5.0
Disambiguation4/5

Tools are mostly distinct, with clear descriptions for each. However, there is some potential overlap between inspection tools like 'inspect' and 'mesh_summary', and between rendering tools 'render_preview' and 'get_latest_render', which could cause minor confusion.

Naming Consistency5/5

All tool names follow a consistent snake_case verb_noun pattern, making it predictable for an agent to infer functionality.

Tool Count2/5

44 tools is significantly higher than the typical well-scoped range of 3-15. While the domain is complex, the count feels excessive and could overwhelm an agent.

Completeness4/5

The tool set covers an extensive range of CAD operations including creation, inspection, rendering, export, and verification. Minor gaps exist, such as direct sketch editing tools, but overall it is comprehensive.