Skip to main content
Glama

validate_openscad_code

Read-only

Validates OpenSCAD code without generating geometry, returning structured errors and warnings with line numbers so you can fix issues before model generation.

Instructions

Validate OpenSCAD code without generating geometry.

Compiles the code and returns structured error/warning information
with line numbers.  Use this to check code before calling
generate_model with OpenSCAD.

:param scad_code: OpenSCAD source code to validate — the same parameter
    name ``compile_scad`` / ``analyze_scad_code`` / ``tweak_and_compile_scad``
    take, so a session that has been compiling can validate without
    learning a second spelling.
:param code: Alias of ``scad_code`` kept for callers that learned it.
:returns: Dict with ``valid``, ``errors``, and ``warnings``.  The check
    answers as ``compile_scad`` would: a setting the called module has
    no parameter for is read by the module's own name when that is
    certain and a measured build confirms it, and the code is valid,
    with ``settings_read`` saying what was read and
    ``corrected_scad_code`` the code to keep; otherwise the code is
    invalid and the first error lists the module's real settings.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "validate_openscad_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNoAlias of ``scad_code`` kept for callers that learned it. Default: "".
scad_codeNoOpenSCAD source code to validate — the same parameter name ``compile_scad`` / ``analyze_scad_code`` / ``tweak_and_compile_scad`` take, so a session that has been compiling can validate without learning a second spelling. Default: "".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.5.1
    • changedInput schema / properties / code / description
      Previous value: -"Default: \"\"."New value: +"Alias of ``scad_code`` kept for callers that learned it. Default: \"\"."
    • changedInput schema / properties / scad_code / description
      Previous value: -"Default: \"\"."New value: +"OpenSCAD source code to validate — the same parameter name ``compile_scad`` / ``analyze_scad_code`` / ``tweak_and_compile_scad`` take, so a session that has been compiling can validate without learning a second spelling. Default: \"\"."
  2. Changed3 schema fields changedv1.5.0
    • addedInput schema / properties / code / description
      Added value: +"Default: \"\"."
    • addedInput schema / properties / scad_code
      Added value: +{
      +  "description": "Default: \"\".",
      +  "title": "Scad Code",
      +  "type": "string"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "code"
      -]
  3. First observedv0.1.0

TDQS

A4.1/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=false, so the safety profile is covered. The description does add what compilation checks and what error/warning info with line numbers comes back, but the middle of the :returns: paragraph (settings read by the module's own name "when that is certain and a measured build confirms it") is opaque and raises more questions than it answers.

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?

Purpose and usage are front-loaded in the first three lines, which is good structure. The :returns: block then sprawls into a convoluted run-on about settings inference that costs tokens without adding actionable clarity.

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?

With no output schema, the description carries the burden of describing returns and it does name valid/errors/warnings/settings_read/corrected_scad_code. Gaps remain: no statement of what happens when both code and scad_code are empty (neither is required) or which alias wins in a conflict, and no note on whether validation is cheap or slow.

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 100%, so the schema already documents both fields identically to the description, making this largely baseline. The one genuinely useful addition is framing scad_code as the shared spelling across compile_scad/analyze_scad_code/tweak_and_compile_scad and code as a legacy alias — though precedence when both are supplied is never stated.

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 specific verb and resource ("Validate OpenSCAD code") plus the key scope boundary "without generating geometry", which cleanly separates it from generate_model and compile_scad. An agent can pick it out of the crowded validate_* sibling set 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 explicit timing: "Use this to check code before calling generate_model with OpenSCAD", and implicitly contrasts with compile_scad ("answers as compile_scad would"). It does not state when *not* to use it, e.g. whether it is redundant if you intend to compile anyway, but the forward guidance is concrete.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools