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).

Input Schema

TableJSON 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.
pdfBase64NoThe 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

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      -]
  2. 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."
  3. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.