Skip to main content
Glama

Project Curve

project_curve
Idempotent

Use this when you need to project a 2D path onto a selected face. Insert <shape>.projectCurve(...) into a kernelCAD script. Closed mode wraps a path and returns a Sketch. Open mode (as_edge: true) takes an explicit source_plane and world-space direction, awaits the projection, and binds every resulting edge as a Curve3D array for downstream curve operations. The source is { kind: "sketchCommands", commands: [...] }. Side-effect-free; returns modified code plus diagnostics.

Input Schema

NameRequiredDescriptionDefault
codeYesThe .kcad.ts source code.
faceYesTarget face — canonical name or label.
targetYesVariable name of the Shape to chain onto.
as_edgeNoOpen-wire projection. When true, commands must be open, source_plane and direction are required, and bind_as receives an awaited Curve3D[] result.
bind_asNoOptional local variable name; emits a const binding (awaited when as_edge is true).
commandsYes2D path as plain-number commands. Closed mode starts with moveTo and ends with close; open mode starts with moveTo, has one or more segments, and has no close.
directionNoRequired with as_edge:true. Non-zero world-space projection direction.
scale_modeNoClosed projection Drawing.sketchOnFace scaling mode. Default original.
source_planeNoRequired with as_edge:true. Places the 2D source path in world space; origin is in mm and x_axis/normal define its frame.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changed
    • addedInput schema / allOf
      Added value: +[
      +  {
      +    "if": {
      +      "properties": {
      +        "as_edge": {
      +          "const": true
      +        }
      +      },
      +      "required": [
      +        "as_edge"
      +      ]
      +    },
      +    "then": {
      +      "not": {
      +        "required": [
      +          "scale_mode"
      +        ]
      +      },
      +      "required": [
      +        "source_plane",
      +        "direction"
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "anyOf": [
      +        {
      +          "required": [
      +            "source_plane"
      +          ]
      +        },
      +        {
      +          "required": [
      +            "direction"
      +          ]
      +        }
      +      ]
      +    },
      +    "then": {
      +      "properties": {
      +        "as_edge": {
      +          "const": true
      +        }
      +      },
      +      "required": [
      +        "as_edge"
      +      ]
      +    }
      +  }
      +]
    • removedInput schema / properties / asEdge
      Removed value: -{
      -  "description": "Open-wire (edge) projection. NOT IMPLEMENTED — rejected at edit time. Use a closed-curve projection (omit asEdge).",
      -  "type": "boolean"
      -}
    • addedInput schema / properties / as_edge
      Added value: +{
      +  "description": "Open-wire projection. When true, commands must be open, source_plane and direction are required, and bind_as receives an awaited Curve3D[] result.",
      +  "type": "boolean"
      +}
    • removedInput schema / properties / bindAs
      Removed value: -{
      -  "description": "Optional local variable name; emits `const <bindAs> = <target>.projectCurve(...);`.",
      -  "type": "string"
      -}
    • addedInput schema / properties / bind_as
      Added value: +{
      +  "description": "Optional local variable name; emits a const binding (awaited when as_edge is true).",
      +  "type": "string"
      +}
    • changedInput schema / properties / commands / description
      Previous value: -"Closed 2D path to wrap onto the face, as plain-number commands. Must start with a `moveTo` and end with a `close` (e.g. [{kind:\"moveTo\",x:0,y:0},{kind:\"lineTo\",x:2,y:0},{kind:\"lineTo\",x:2,y:2},{kind:\"close\"}])."New value: +"2D path as plain-number commands. Closed mode starts with moveTo and ends with close; open mode starts with moveTo, has one or more segments, and has no close."
    • addedInput schema / properties / direction
      Added value: +{
      +  "description": "Required with as_edge:true. Non-zero world-space projection direction.",
      +  "items": {
      +    "type": "number"
      +  },
      +  "maxItems": 3,
      +  "minItems": 3,
      +  "type": "array"
      +}
    • removedInput schema / properties / scaleMode
      Removed value: -{
      -  "description": "Drawing.sketchOnFace scaling mode. Default original.",
      -  "enum": [
      -    "original",
      -    "native",
      -    "bounds"
      -  ],
      -  "type": "string"
      -}
    • addedInput schema / properties / scale_mode
      Added value: +{
      +  "description": "Closed projection Drawing.sketchOnFace scaling mode. Default original.",
      +  "enum": [
      +    "original",
      +    "native",
      +    "bounds"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / source_plane
      Added value: +{
      +  "description": "Required with as_edge:true. Places the 2D source path in world space; origin is in mm and x_axis/normal define its frame.",
      +  "properties": {
      +    "normal": {
      +      "items": {
      +        "type": "number"
      +      },
      +      "maxItems": 3,
      +      "minItems": 3,
      +      "type": "array"
      +    },
      +    "origin": {
      +      "items": {
      +        "type": "number"
      +      },
      +      "maxItems": 3,
      +      "minItems": 3,
      +      "type": "array"
      +    },
      +    "x_axis": {
      +      "items": {
      +        "type": "number"
      +      },
      +      "maxItems": 3,
      +      "minItems": 3,
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "origin",
      +    "normal",
      +    "x_axis"
      +  ],
      +  "type": "object"
      +}
  2. 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"
      -]
  3. Changed4 schema fields changed
    • changedInput schema / properties / asEdge / description
      Previous value: -"Project as an open edge instead of a closed face-bound sketch. Currently deferred."New value: +"Open-wire (edge) projection. NOT IMPLEMENTED — rejected at edit time. Use a closed-curve projection (omit asEdge)."
    • addedInput schema / properties / commands
      Added value: +{
      +  "description": "Closed 2D path to wrap onto the face, as plain-number commands. Must start with a `moveTo` and end with a `close` (e.g. [{kind:\"moveTo\",x:0,y:0},{kind:\"lineTo\",x:2,y:0},{kind:\"lineTo\",x:2,y:2},{kind:\"close\"}]).",
      +  "items": {
      +    "properties": {
      +      "kind": {
      +        "enum": [
      +          "moveTo",
      +          "lineTo",
      +          "close"
      +        ],
      +        "type": "string"
      +      },
      +      "x": {
      +        "type": "number"
      +      },
      +      "y": {
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "kind"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • removedInput schema / properties / curveExpression
      Removed value: -{
      -  "description": "JS expression returning a closed sketch (e.g. `path().moveTo(0,0).lineTo(2,0).lineTo(2,2).close().build()`). Inserted verbatim as the `curve:` field.",
      -  "type": "string"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "code",
      -  "target",
      -  "curveExpression",
      -  "face"
      -]New value: +[
      +  "code",
      +  "target",
      +  "commands",
      +  "face"
      +]
  4. 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"
      +}
  5. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare idempotent=true, destructive=false, readOnlyHint=false, so the safety profile is mostly covered; the description adds real behavioral content beyond that — mode-dependent return types (Sketch vs a bound Curve3D array), the fact that open mode awaits the projection, and that the tool emits modified code plus diagnostics. The only friction is a soft tension between 'Side-effect-free' and readOnlyHint=false, which reads as 'does not mutate the CAD model' rather than a hard contradiction.

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?

It is front-loaded with the when-to-use clause, then moves through call form, closed mode, open mode, source shape, and return behavior in a logical order with no filler sentences. It is dense and jargon-heavy, which costs a point for accessibility, but every sentence carries information.

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

Completeness4/5

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

For a nine-parameter tool with nested objects and mode-dependent behavior, the description covers the essentials an agent needs: which mode to pick, what each mode requires, and what comes back. Details like `scale_mode` and `bind_as` are left to the schema, which is acceptable given full coverage and an existing output schema.

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

Parameters3/5

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

Schema description coverage is 100%, so all nine parameters, including the nested source_plane frame and the closed/open `commands` rules, are already documented in structured fields. The description restates the closed/open requirements and adds the outer wrapper shape (`{ kind: "sketchCommands", commands: [...] }`), but that wrapper is not a parameter and adds only modest value, so it sits at the baseline.

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 verb and resource ('project a 2D path onto a selected face') and goes beyond the title by naming the exact call form (`<shape>.projectCurve(...)`) and the two projection modes. An agent can distinguish this from curve-construction siblings like add_curve or add_path_segment without opening any schema.

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 leads with 'Use this when you need to project a 2D path onto a selected face,' which is an explicit usage condition, and it separates closed mode (wraps a path, returns a Sketch) from open mode (`as_edge: true`, explicit `source_plane`/`direction`). There is no explicit when-not guidance or named alternative tool, 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.