Skip to main content
Glama

to_cadquery

Generate an editable parametric CadQuery script from a mesh, with named dimensions and a fidelity check, so you can edit parameters and regenerate the CAD part.

Instructions

Write an editable parametric CadQuery script (.py) for a simple part.

Works for a box/plate base with rectangular pads, holes along X, Y, or Z (through, blind, counterbored, and countersunk when the axis is vertical), bosses along X, Y, or Z (straight, and drafted or chamfered when the axis is vertical), fillet_r on the four vertical corners, edge_fillet_r when every edge of the box shares one radius (a through-hole that clears those rounds is cut after the fillet, and a straight boss that clears them is fused after it), fillet_r on every vertical edge of an L-bracket including the inner corner (base_x, base_y, base_t, leg_x, leg_y), through-holes in the foot and the upright of that bracket (base_hole_N_d, leg_hole_N_d), a row, axis-aligned grid, or bolt circle of plain Z through-holes (hole_row_1_n, hole_row_1_pitch, hole_grid_1_nx, hole_grid_1_pitch_x, hole_circle_1_n, hole_circle_1_r), a straight obround through-slot along Z (slot_1_len, slot_1_w, slot_1_x, slot_1_y, slot_1_angle), a fillet at the base of a vertical boss (boss_N_fillet), a round on a vertical hole rim (hole_N_rim_r, hole_N_bot_rim_r) and a blind-hole floor fillet (hole_N_floor_r), a straight extrusion of a 2D outline along X, Y, or Z (straight round bosses on the top face of a Z extrusion are boss_N_d, boss_N_h, boss_N_x, boss_N_y; a vertical countersink on that Z extrusion is hole_N_csk_d and hole_N_csk_angle, and a counterbore is hole_N_cbore_d and hole_N_cbore_depth; vertical corners of that Z extrusion that share one radius are outline_fillet_r), and a small boolean of those extrusions (intersection, or one minus a cut along another axis) with round through-holes, counterbores, and a few planar clips. Each dimension is a named parameter (e.g. hole_1_d = 6.0, extrude_len): edit it and run the script with Python to regenerate the part. Returns the parameters and the measured deviation of the script's output from the mesh. Returns an "error" key when the part is outside that vocabulary.

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": {
      "input_path": "<input_path>"
    },
    "name": "to_cadquery"
  }
}

Input Schema

NameRequiredDescriptionDefault
tolNo
input_pathYes
output_pathNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.12.0

TDQS

C2.6/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full burden. It does disclose the failure mode (an 'error' key for out-of-vocabulary parts) and the return content (parameters plus measured deviation from the mesh), which is genuinely useful. But it never states that it writes a file to disk, whether an existing output file is overwritten, what the source of 'the mesh' is, or what tol does, leaving the mutation and input requirements opaque.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core statement is front-loaded, but the middle is a single ~250-word run-on sentence of nested parenthetical feature names and parameter identifiers that is very hard to parse. That vocabulary is real content, yet dumping it in prose rather than a structured list or the schema makes the definition bloated and skimmable only with difficulty.

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

Completeness2/5

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

There is no output schema and no annotations, and the three input parameters are entirely undocumented, so an agent cannot determine what file to pass or what tol does. The description does cover the supported feature vocabulary and the shape of the return value (parameters, deviation, error key), but the invocation-critical information is missing.

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

Parameters1/5

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

Schema description coverage is 0% across three parameters, and the description compensates for none of them: input_path, output_path, and tol are never mentioned or explained. The only indirect hint is the phrase 'deviation of the script's output from the mesh', leaving the agent to guess that input_path is a mesh file and output_path is the .py destination.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence gives a specific verb and artifact: write an editable parametric CadQuery script (.py) for a simple part. The target format implicitly separates it from to_freecad and to_openscad, though no sibling is named and the reader must infer that the choice of CadQuery vs the other converters is the differentiator.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: 'for a simple part' and 'Returns an "error" key when the part is outside that vocabulary' set a scope boundary, which tells the agent the tool is for parts within a fixed feature vocabulary. There is no explicit when-to-use versus when-to-prefer to_freecad/to_openscad, and no stated prerequisite for what kind of input (mesh) is expected.

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