Skip to main content
Glama

Add Curve

add_curve

Use this when you need a freeform/organic 3D curve — a body feature line, brow, spine rail, or G2 blend between panels — authored as a Curve3D into the user's .kcad.ts immediately before the last top-level return. One authoring path, selected by kind:

  • 'nurbs' — insert a nurbsCurve(controlPoints, opts?) declaration. Pass controlPoints as a Vec3[] (mm, at least 2 points). Optional NURBS knobs: degree (default 3), rational weights, explicit knots, closed.

  • 'hermite' — insert a hermiteG2(a, b) declaration: a quintic Hermite curve interpolating two endpoints with matching positions, tangents, and (optional) curvatures — bridges two curves with G2 continuity. Each endpoint is { point: Vec3, tangent: Vec3, curvature?: Vec3 } in mm; tangent magnitude ~ chord length; curvature defaults to [0,0,0] (G1-only). The returned binding has type Curve3D (peer to Shape / Surface) — consume it via add_variable_sweep (spine input), add_surface({ kind: 'boundary' }) (boundary curve), or downstream Curve3D-accepting features. Returns the modified code + diagnostics from re-evaluating. Side-effect-free. Each kind fails closed on its own missing required params.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aNokind:'hermite' — start endpoint.
bNokind:'hermite' — end endpoint.
codeYesThe .kcad.ts source code.
kindYesWhich curve-construction path to use.
knotsNokind:'nurbs' — optional explicit knot vector; missing => clamped-uniform inferred.
closedNokind:'nurbs' — optional periodic/closed-curve flag.
degreeNokind:'nurbs' — curve degree; default 3 (cubic).
weightsNokind:'nurbs' — optional rational weights, one per control point (same length as controlPoints).
binding_nameNoJS const name for the new Curve3D binding (default: _curve_<N>).
controlPointsNokind:'nurbs' — control points as Vec3 triples in mm; at least 2 entries.

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).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / b / properties / curvature / description
      Added value: +"Optional second derivative; defaults to [0, 0, 0] (G1-only)."
    • addedInput schema / properties / b / properties / point / description
      Added value: +"Endpoint position in mm."
    • addedInput schema / properties / b / properties / tangent / description
      Added value: +"First derivative of the curve at this endpoint."
  2. Changed1 schema field changed
    • addedInput schema / allOf
      Added value: +[
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "nurbs"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "controlPoints"
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "hermite"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "a",
      +        "b"
      +      ]
      +    }
      +  }
      +]
  3. Changed1 schema field changed
    • removedInput schema / allOf
      Removed value: -[
      -  {
      -    "if": {
      -      "properties": {
      -        "kind": {
      -          "const": "nurbs"
      -        }
      -      }
      -    },
      -    "then": {
      -      "required": [
      -        "controlPoints"
      -      ]
      -    }
      -  },
      -  {
      -    "if": {
      -      "properties": {
      -        "kind": {
      -          "const": "hermite"
      -        }
      -      }
      -    },
      -    "then": {
      -      "required": [
      -        "a",
      -        "b"
      -      ]
      -    }
      -  }
      -]
  4. Changed1 schema field changed
    • addedInput schema / allOf
      Added value: +[
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "nurbs"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "controlPoints"
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "hermite"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "a",
      +        "b"
      +      ]
      +    }
      +  }
      +]
  5. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "binding_name": {
      +      "description": "JS const name bound to the new construct (when one was created).",
      +      "type": "string"
      +    },
      +    "diagnostics": {
      +      "description": "Diagnostics from re-evaluating the modified source.",
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "error": {
      +      "description": "Failure message (present when ok is false).",
      +      "type": "string"
      +    },
      +    "new_code": {
      +      "description": "Modified .kcad.ts source (present on success). Caller persists it.",
      +      "type": "string"
      +    },
      +    "ok": {
      +      "description": "Whether the edit applied and re-evaluated cleanly.",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "ok"
      +  ],
      +  "type": "object"
      +}
  6. Added

TDQS

A4.8/5.0
Behavior5/5

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

Beyond annotations, the description discloses precise insertion location ('immediately before the last top-level return'), side-effect-free behavior, failure behavior ('fails closed on its own missing required params'), and the exact declaration types inserted for each kind. This substantially enriches the agent's model of the operation.

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

Conciseness5/5

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

The description is dense but well-organized: the purpose is front-loaded, followed by kind-specific bullets and downstream consumption. Every sentence contributes to correct invocation (semantics, defaults, failure mode, insertion point), with no fluff.

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 the tool's complexity (10 params, nested objects, two authoring paths), the description covers when to use it, what each kind produces, how parameters are interpreted, where code is inserted, and how the result is consumed by sibling tools. The output schema exists, so return values need no extra explanation.

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?

Even though schema coverage is 100%, the description adds key meaning: tangent magnitude heuristic ('~ chord length'), curvature default effect (G1-only), NURBS defaults and optional knobs, and the G2 continuity semantics for the hermite path. This goes beyond the schema's basic descriptions.

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?

The description states a specific action and resource: it authors a Curve3D into the user's .kcad.ts, with concrete use cases (body feature line, brow, spine rail, G2 blend). This clearly distinguishes it from sibling add_* tools, which target different objects (surfaces, features, connectors).

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?

It begins with an explicit 'Use this when you need a freeform/organic 3D curve' and lists concrete use cases, providing clear when-to-use context. It does not explicitly state when not to use it or name alternative tools, so it stops short of a 5.

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.