Skip to main content
Glama

Add Pattern Feature

add_pattern_feature

Use this when you need to repeat a feature in a pattern. Insert a Shape.patternLinear / .patternCircular / .patternGrid call into a kernelCAD script before the last top-level return. Pass structured args (kind + the matching spec object). Returns the modified code plus diagnostics from re-evaluating. Side-effect-free. The pattern feature is a single editable unit; pattern-instance face refs resolve via <sourceId>_pattern_<i> on the pattern feature's lineage. Geometric note: pattern is implemented as cumulative boolean union of transformed source copies — additive features (boxes, ribs, fins, spokes) pattern cleanly; patterning a subtractive feature (hole, cutout) only preserves the per-instance void when adjacent bodies are disjoint.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe .kcad.ts source code.
gridNoRequired when kind=grid.
kindYes
linearNoRequired when kind=linear.
targetYesVariable name of the Shape to pattern (inserted verbatim as the LHS receiver).
circularNoRequired when kind=circular.
assign_toNoOptional const-binding name; emits `const <assign_to> = <target>.patternX(...);`. Omit for statement form.

Output Schema

TableJSON 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. Changed7 schema fields changed
    • addedInput schema / allOf
      Added value: +[
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "linear"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "linear"
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "circular"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "circular"
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "grid"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "grid"
      +      ]
      +    }
      +  }
      +]
    • addedInput schema / properties / grid / properties / x / description
      Added value: +"First grid axis."
    • addedInput schema / properties / grid / properties / x / properties
      Added value: +{
      +  "count": {
      +    "minimum": 2,
      +    "type": "integer"
      +  },
      +  "direction": {
      +    "items": {
      +      "type": "number"
      +    },
      +    "maxItems": 3,
      +    "minItems": 3,
      +    "type": "array"
      +  },
      +  "spacing": {
      +    "type": "number"
      +  }
      +}
    • addedInput schema / properties / grid / properties / x / required
      Added value: +[
      +  "count",
      +  "direction",
      +  "spacing"
      +]
    • addedInput schema / properties / grid / properties / y / description
      Added value: +"Second grid axis."
    • addedInput schema / properties / grid / properties / y / properties
      Added value: +{
      +  "count": {
      +    "minimum": 2,
      +    "type": "integer"
      +  },
      +  "direction": {
      +    "items": {
      +      "type": "number"
      +    },
      +    "maxItems": 3,
      +    "minItems": 3,
      +    "type": "array"
      +  },
      +  "spacing": {
      +    "type": "number"
      +  }
      +}
    • addedInput schema / properties / grid / properties / y / required
      Added value: +[
      +  "count",
      +  "direction",
      +  "spacing"
      +]
  3. Changed7 schema fields changed
    • removedInput schema / allOf
      Removed value: -[
      -  {
      -    "if": {
      -      "properties": {
      -        "kind": {
      -          "const": "linear"
      -        }
      -      }
      -    },
      -    "then": {
      -      "required": [
      -        "linear"
      -      ]
      -    }
      -  },
      -  {
      -    "if": {
      -      "properties": {
      -        "kind": {
      -          "const": "circular"
      -        }
      -      }
      -    },
      -    "then": {
      -      "required": [
      -        "circular"
      -      ]
      -    }
      -  },
      -  {
      -    "if": {
      -      "properties": {
      -        "kind": {
      -          "const": "grid"
      -        }
      -      }
      -    },
      -    "then": {
      -      "required": [
      -        "grid"
      -      ]
      -    }
      -  }
      -]
    • removedInput schema / properties / grid / properties / x / description
      Removed value: -"First grid axis."
    • removedInput schema / properties / grid / properties / x / properties
      Removed value: -{
      -  "count": {
      -    "minimum": 2,
      -    "type": "integer"
      -  },
      -  "direction": {
      -    "items": {
      -      "type": "number"
      -    },
      -    "maxItems": 3,
      -    "minItems": 3,
      -    "type": "array"
      -  },
      -  "spacing": {
      -    "type": "number"
      -  }
      -}
    • removedInput schema / properties / grid / properties / x / required
      Removed value: -[
      -  "count",
      -  "direction",
      -  "spacing"
      -]
    • removedInput schema / properties / grid / properties / y / description
      Removed value: -"Second grid axis."
    • removedInput schema / properties / grid / properties / y / properties
      Removed value: -{
      -  "count": {
      -    "minimum": 2,
      -    "type": "integer"
      -  },
      -  "direction": {
      -    "items": {
      -      "type": "number"
      -    },
      -    "maxItems": 3,
      -    "minItems": 3,
      -    "type": "array"
      -  },
      -  "spacing": {
      -    "type": "number"
      -  }
      -}
    • removedInput schema / properties / grid / properties / y / required
      Removed value: -[
      -  "count",
      -  "direction",
      -  "spacing"
      -]
  4. Changed7 schema fields changed
    • addedInput schema / allOf
      Added value: +[
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "linear"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "linear"
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "circular"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "circular"
      +      ]
      +    }
      +  },
      +  {
      +    "if": {
      +      "properties": {
      +        "kind": {
      +          "const": "grid"
      +        }
      +      }
      +    },
      +    "then": {
      +      "required": [
      +        "grid"
      +      ]
      +    }
      +  }
      +]
    • addedInput schema / properties / grid / properties / x / description
      Added value: +"First grid axis."
    • addedInput schema / properties / grid / properties / x / properties
      Added value: +{
      +  "count": {
      +    "minimum": 2,
      +    "type": "integer"
      +  },
      +  "direction": {
      +    "items": {
      +      "type": "number"
      +    },
      +    "maxItems": 3,
      +    "minItems": 3,
      +    "type": "array"
      +  },
      +  "spacing": {
      +    "type": "number"
      +  }
      +}
    • addedInput schema / properties / grid / properties / x / required
      Added value: +[
      +  "count",
      +  "direction",
      +  "spacing"
      +]
    • addedInput schema / properties / grid / properties / y / description
      Added value: +"Second grid axis."
    • addedInput schema / properties / grid / properties / y / properties
      Added value: +{
      +  "count": {
      +    "minimum": 2,
      +    "type": "integer"
      +  },
      +  "direction": {
      +    "items": {
      +      "type": "number"
      +    },
      +    "maxItems": 3,
      +    "minItems": 3,
      +    "type": "array"
      +  },
      +  "spacing": {
      +    "type": "number"
      +  }
      +}
    • addedInput schema / properties / grid / properties / y / required
      Added value: +[
      +  "count",
      +  "direction",
      +  "spacing"
      +]
  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. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.