Skip to main content
Glama

Add Curve

add_curve
Idempotent

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

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

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedOutput schema / properties
      Removed value: -{
      -  "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"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok"
      -]
  2. 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."
  3. 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"
      +      ]
      +    }
      +  }
      +]
  4. 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"
      -      ]
      -    }
      -  }
      -]
  5. 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"
      +      ]
      +    }
      +  }
      +]
  6. 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"
      +}
  7. Added

TDQS

A4.4/5.0
Behavior4/5

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

Goes well beyond the annotations by disclosing that it inserts a declaration at a specific point in existing source, returns the modified code plus diagnostics from re-evaluation, and that each kind fails closed on missing params. Minor caveat: 'Side-effect-free' sits in mild tension with readOnlyHint=false, though it plausibly means no persistent model mutation beyond the returned code. Idempotent/non-destructive hints are consistent with the text.

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?

Front-loads the use case and insertion behavior, then a clean per-kind bullet breakdown. Some sentences restate schema-documented defaults (degree, weights, knots, closed), which is mild duplication rather than filler.

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?

For a two-path, 10-parameter authoring tool operating on source code, the description covers both construction kinds, required inputs, the binding/return type, failure behavior, and downstream consumers. An output schema exists, so the brief mention of returns is a bonus rather than a gap.

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

Parameters4/5

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

With 100% schema coverage the baseline is 3, so credit goes to genuinely additive guidance: tangent magnitude should approximate chord length, curvature defaults to [0,0,0] giving G1-only, controlPoints are mm Vec3 triples with a minimum of 2, and knots default to clamped-uniform. Only 'code' and 'binding_name' are left to the schema alone.

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?

Specific verb+resource ('add a freeform/organic 3D curve authored as a Curve3D into the .kcad.ts') with concrete use cases (feature line, brow, spine rail, G2 blend). It also establishes insertion location ('immediately before the last top-level return') and the return type (Curve3D, peer to Shape/Surface), which separates it from add_path_segment, add_surface, and project_curve.

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?

Explicitly states the triggering need ('when you need a freeform/organic 3D curve') and routes downstream consumption to add_variable_sweep and add_surface boundary. It does not, however, say when to prefer siblings such as add_path_segment or project_curve instead, so the negative cases are left implicit.

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.