Skip to main content
Glama

Convert Drawing to CAD

drawing_to_cad

Use this when the reference for a part is a 2D engineering drawing PDF (orthographic views with dimensions), not a photo. Deterministic, no vision model: reads the vector linework (stroke width, dash) and positioned text; classifies visible / hidden / center / dimension / extension lines; reads the title block scale, units and projection symbol; identifies front / top / side views by projection alignment (third- or first-angle); ties dimension text to its lines (⌀, R, 4×, ±, THRU, depth). Dimension values win over measured lengths. Rebuilds the part as the view silhouette extruded by the depth an orthogonal view shows, or a turned part revolved from its half-silhouette, plus holes from ⌀ circles with THRU or hidden-line depth. Returns script — a .kcad.ts with role-named params (width, thickness, holeDia, hole1X, dia1, step1Length …) — and ledger, an assumption ledger where stated dimensions are visible, symmetry-derived positions inferred, defaults assumed and an unstated depth missing; a dimension that disagrees with the linework keeps its value and records the disagreement as an open fact. With verify (default) the script is evaluated, re-projected through the svg-drawing view stage and compared: fidelity.verdict is match | partial | mismatch | failed with per-axis extents, hole diameters and per-view silhouette IoU. Pass out to write the script and its <stem>.ledger.json (resolve open facts with resolve_assumptions, then set_param). A scanned (raster-only) page fails with reference.drawing.raster-only — use trace_from_image for those. Hosted: give the file as an https:// URL, a data: URI (base64, max 25 MB) or "asset:" from request_upload (when the file is on the user's device).

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": "drawing_to_cad"
  }
}

Input Schema

NameRequiredDescriptionDefault
outNoWrite the emitted script here (a .kcad.ts path); the ledger is written beside it as <stem>.ledger.json.
pageNo1-based page to read. Default 1.
pathNoPath to the drawing PDF on the machine running kernelCAD. Hosted server: pass an https:// URL, a data: URI, or "asset:<id>" from request_upload — not a path on your machine.
intentNoThe user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.
verifyNoEvaluate the rebuilt part and compare it with the drawing. Default true.
pdf_base64NoThe PDF inline, base64-encoded. Use this instead of `path` against a hosted kernelCAD server.
projectionNoOverride the projection angle read from the sheet (default: projection symbol or note, else third-angle).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedInput schema / properties / pdfBase64
      Removed value: -{
      -  "description": "The PDF inline, base64-encoded. Use this instead of `path` against a hosted kernelCAD server.",
      -  "type": "string"
      -}
    • addedInput schema / properties / pdf_base64
      Added value: +{
      +  "description": "The PDF inline, base64-encoded. Use this instead of `path` against a hosted kernelCAD server.",
      +  "type": "string"
      +}
  2. Changed2 schema fields changed
    • removedOutput schema / properties
      Removed value: -{
      -  "diagnostics": {
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "fidelity": {
      -    "additionalProperties": true,
      -    "description": "{ verdict: match | partial | mismatch | failed, extents, holes, silhouettes, reasons } from evaluating and re-projecting the script.",
      -    "type": "object"
      -  },
      -  "ledger": {
      -    "additionalProperties": true,
      -    "description": "Assumption ledger: { facts, unresolvedCount }; facts are visible / inferred / assumed / missing, disagreements recorded on the fact.",
      -    "type": "object"
      -  },
      -  "ledgerPath": {
      -    "description": "Where the ledger was written (when `out` was given); pass it to resolve_assumptions.",
      -    "type": "string"
      -  },
      -  "ok": {
      -    "type": "boolean"
      -  },
      -  "page": {
      -    "type": "integer"
      -  },
      -  "pageCount": {
      -    "type": "integer"
      -  },
      -  "params": {
      -    "description": "Role-named params declared by the script: { name, value, description }.",
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "reconstruction": {
      -    "additionalProperties": true,
      -    "description": "{ kind: extrude | revolve, profileView, axis, holeCount, extents }.",
      -    "type": "object"
      -  },
      -  "script": {
      -    "description": "The emitted .kcad.ts source.",
      -    "type": "string"
      -  },
      -  "scriptPath": {
      -    "description": "Where the script was written (when `out` was given).",
      -    "type": "string"
      -  },
      -  "sheet": {
      -    "additionalProperties": true,
      -    "description": "{ widthMm, heightMm, scale: { text, sheetPerModel, source }, units, projection } read off the sheet.",
      -    "type": "object"
      -  },
      -  "views": {
      -    "description": "Identified orthographic views: { name, bboxMm, identifiedBy, label? }.",
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok",
      -  "views",
      -  "params",
      -  "ledger",
      -  "diagnostics"
      -]
  3. Changed2 schema fields changed
    • addedInput schema / properties / intent
      Added value: +{
      +  "description": "The user's request in one sentence, in the user's own words and language (e.g. 'M4 bracket for a 25 mm tube, print on Bambu A1'). Helps kernelCAD improve; leave out personal data.",
      +  "maxLength": 2000,
      +  "type": "string"
      +}
    • changedInput schema / properties / path / description
      Previous value: -"Path to the drawing PDF on the machine running kernelCAD."New value: +"Path to the drawing PDF on the machine running kernelCAD. Hosted server: pass an https:// URL, a data: URI, or \"asset:<id>\" from request_upload — not a path on your machine."
  4. Added

TDQS

A4.5/5.0
Behavior3/5

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

Annotations only declare the generic profile (readOnlyHint=false, openWorldHint=true, idempotentHint=false, destructiveHint=false), so the description carries most of the burden and does it well: deterministic with no vision model, verify defaults to true and re-projects through the svg-drawing view stage, fidelity.verdict enumeration, ledger fact-status taxonomy, and a named failure mode. The remaining gap is that 'destructiveHint=false' coexists with writing files to `out` and no overwrite/observability-behavior is stated, but no contradiction exists.

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

Conciseness5/5

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

Front-loads the selection rule in the first sentence, then proceeds pipeline → outputs → verification → failure mode → hosting, each sentence carrying new information. It is dense and long, but no clause is filler and the ordering matches the agent's decision sequence.

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

Completeness5/5

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

Despite output_schema being present, the description still names the key return fields (`script`, `ledger`, `fidelity.verdict`) and their semantics well enough to plan next steps. Combined with the hosting note, raster failure mode, and verify default, an agent has everything needed to call this correctly on the first attempt for a high-complexity tool.

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 description coverage is 100%, so the baseline is 3; the description goes further by clarifying that `out` also writes `<stem>.ledger.json` beside it, that verify is on by default and what it compares, that `page` defaults to 1, and that hosted callers must supply an https:// URL, data: URI, or asset:<id> rather than a local path. That meaningfully reinforces the two parameters (path, projection) most likely to be misused, though it restates some schema text.

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 ('Convert Drawing to CAD' realized as a deterministic drawing-PDF-to-script pipeline) and immediately bounds the input class: '2D engineering drawing PDF (orthographic views with dimensions), not a photo.' The mechanism is named (vector linework, title-block scale, projection alignment), so an agent can distinguish this from trace_from_image without opening either schema.

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

Usage Guidelines5/5

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

Gives an explicit when-to-use trigger ('when the reference for a part is a 2D engineering drawing PDF'), an explicit when-not with the alternative named ('not a photo' ... 'a scanned (raster-only) page fails with reference.drawing.raster-only — use trace_from_image for those'), and a follow-on workflow (resolve_assumptions, then set_param) for open facts. Routing decisions are fully determined.

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.