Skip to main content
Glama

Add Text

add_text

Use this when you need to author text into a kernelCAD script before the last top-level return. One authoring path, selected by mode:

  • 'sketch' — insert a sketch.text(...) call. The emitted sketch is chainable: pair with subsequent .extrude(...) / cut(...) edits to land an engraved or raised text feature.

  • 'emboss' — insert a <shape>.embossText({...}) chained call onto an existing Shape target. Use for engraved brand text on faces (Ray-Ban temple, CE mark, model number). depth > 0 raises text out of the face; depth < 0 engraves text into the face. Lowers via replicad drawText → sketchOnFace → extrude → fuse|cut. Default font is the runtime-bundled Liberation Sans. Side-effect-free; returns the modified code plus diagnostics from re-evaluating. Each mode fails closed on its own missing required params.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe .kcad.ts source code.
faceNomode:'emboss' — target face — canonical name ('top'/'bottom'/'left'/'right'/'front'/'back') or label.
fontNomode:'sketch' — optional logical font name or .ttf file path; defaults to bundled Liberation Sans.
modeYesWhich text-authoring path to use.
sizeNomode:'sketch'|'emboss' — glyph cap height in mm (positive finite).
alignNomode:'sketch' — horizontal alignment relative to position (default left); mode:'emboss' — relative to the UV anchor (default center).
depthNomode:'emboss' — signed extrusion depth in mm: positive emboss out, negative engrave in. Must be non-zero.
bindAsNomode:'sketch' — emits `const <bindAs> = sketch.text(...)`; mode:'emboss' — emits `const <bindAs> = <target>.embossText(...);`.
targetNomode:'emboss' — variable name of the Shape to chain onto (inserted verbatim).
anchorUNomode:'emboss' — U anchor in [0, 1] face-local (0=umin, 0.5=centre, 1=umax). Default 0.5.
anchorVNomode:'emboss' — V anchor in [0, 1] face-local. Default 0.5.
contentNomode:'sketch' — text content (UTF-8, non-empty, non-whitespace).
positionNomode:'sketch' — [x, y] anchor in mm. Default [0, 0].
rotationNomode:'sketch' — CCW rotation in degrees around position (default 0); mode:'emboss' — CCW rotation in the face tangent plane (default 0).
scaleModeNomode:'emboss' — Drawing.sketchOnFace scaling mode. Default original.
fontFamilyNomode:'emboss' — optional logical font name or .ttf file path; defaults to bundled Liberation Sans.
textContentNomode:'emboss' — text content (UTF-8, non-empty, non-whitespace).

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. 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"
      +}
  3. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.