Skip to main content
Glama

Add Text

add_text
Idempotent

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.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "mode": "<mode>",
      "code": "<code>"
    },
    "name": "add_text"
  }
}

Input 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.
targetNomode:'emboss' — variable name of the Shape to chain onto (inserted verbatim).
bind_asNomode:'sketch' — emits `const <bind_as> = sketch.text(...)`; mode:'emboss' — emits `const <bind_as> = <target>.embossText(...);`.
contentNomode:'sketch' — text content (UTF-8, non-empty, non-whitespace).
anchor_uNomode:'emboss' — U anchor in [0, 1] face-local (0=umin, 0.5=centre, 1=umax). Default 0.5.
anchor_vNomode:'emboss' — V anchor in [0, 1] face-local. Default 0.5.
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).
scale_modeNomode:'emboss' — Drawing.sketchOnFace scaling mode. Default original.
font_familyNomode:'emboss' — optional logical font name or .ttf file path; defaults to bundled Liberation Sans.
text_contentNomode:'emboss' — text content (UTF-8, non-empty, non-whitespace).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changed
    • removedInput schema / properties / anchorU
      Removed value: -{
      -  "description": "mode:'emboss' — U anchor in [0, 1] face-local (0=umin, 0.5=centre, 1=umax). Default 0.5.",
      -  "type": "number"
      -}
    • removedInput schema / properties / anchorV
      Removed value: -{
      -  "description": "mode:'emboss' — V anchor in [0, 1] face-local. Default 0.5.",
      -  "type": "number"
      -}
    • addedInput schema / properties / anchor_u
      Added value: +{
      +  "description": "mode:'emboss' — U anchor in [0, 1] face-local (0=umin, 0.5=centre, 1=umax). Default 0.5.",
      +  "type": "number"
      +}
    • addedInput schema / properties / anchor_v
      Added value: +{
      +  "description": "mode:'emboss' — V anchor in [0, 1] face-local. Default 0.5.",
      +  "type": "number"
      +}
    • removedInput schema / properties / bindAs
      Removed value: -{
      -  "description": "mode:'sketch' — emits `const <bindAs> = sketch.text(...)`; mode:'emboss' — emits `const <bindAs> = <target>.embossText(...);`.",
      -  "type": "string"
      -}
    • addedInput schema / properties / bind_as
      Added value: +{
      +  "description": "mode:'sketch' — emits `const <bind_as> = sketch.text(...)`; mode:'emboss' — emits `const <bind_as> = <target>.embossText(...);`.",
      +  "type": "string"
      +}
    • removedInput schema / properties / fontFamily
      Removed value: -{
      -  "description": "mode:'emboss' — optional logical font name or .ttf file path; defaults to bundled Liberation Sans.",
      -  "type": "string"
      -}
    • addedInput schema / properties / font_family
      Added value: +{
      +  "description": "mode:'emboss' — optional logical font name or .ttf file path; defaults to bundled Liberation Sans.",
      +  "type": "string"
      +}
    • removedInput schema / properties / scaleMode
      Removed value: -{
      -  "description": "mode:'emboss' — Drawing.sketchOnFace scaling mode. Default original.",
      -  "enum": [
      -    "original",
      -    "native",
      -    "bounds"
      -  ],
      -  "type": "string"
      -}
    • addedInput schema / properties / scale_mode
      Added value: +{
      +  "description": "mode:'emboss' — Drawing.sketchOnFace scaling mode. Default original.",
      +  "enum": [
      +    "original",
      +    "native",
      +    "bounds"
      +  ],
      +  "type": "string"
      +}
    • removedInput schema / properties / textContent
      Removed value: -{
      -  "description": "mode:'emboss' — text content (UTF-8, non-empty, non-whitespace).",
      -  "type": "string"
      -}
    • addedInput schema / properties / text_content
      Added value: +{
      +  "description": "mode:'emboss' — text content (UTF-8, non-empty, non-whitespace).",
      +  "type": "string"
      +}
  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. 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"
      +}
  4. Added

TDQS

A4.3/5.0
Behavior4/5

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

Goes well beyond the annotations: discloses the emitted code shape for each mode, the underlying replicad pipeline (drawText → sketchOnFace → extrude → fuse|cut), the default bundled font, and that each mode fails closed on missing required params. The phrase 'side-effect-free' sits in mild tension with readOnlyHint=false, though the following clause ('returns the modified code') makes the intended meaning — a pure transform rather than an in-place mutation — recoverable.

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-loaded purpose sentence followed by a scannable mode-by-mode breakdown with no filler. The replicad internals clause is arguably implementation detail an agent doesn't need, but it is one short sentence and buys some behavioral predictability.

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 17-parameter mutation tool with annotations and an output schema, the description covers mode routing, key defaults, failure behavior, and emitted-code semantics. Minor gaps remain: it doesn't say what the diagnostics contain or address naming collisions when `bind_as`/`target` reference existing variables.

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?

Schema coverage is already 100%, so the baseline is 3; the description adds real meaning on top by explaining what the emitted code does for `bind_as`, `target` (inserted verbatim), and chainability of the 'sketch' result, plus how `depth` sign maps to raised vs engraved. It does not explain how overlapping params (font vs font_family, content vs text_content) differ beyond the per-mode labels in the schema.

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?

States a concrete verb and target ('author text into a kernelCAD script before the last top-level return') and immediately distinguishes the two operations it performs via the `mode` enum. An agent can tell this apart from siblings like add_curve or add_feature without opening the 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?

Gives clear when-to-use guidance for each mode: 'sketch' for chainable sketch.text paired with subsequent .extrude(...)/cut(...), 'emboss' for engraved or raised brand text on a specific face, with worked examples (Ray-Ban temple, CE mark, model number). No explicit exclusions or named alternative sibling 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.