Skip to main content
Glama

Export

export

Use this when you need to export geometry to a file. One exporter, selected by target:

  • target:'model' — export the script geometry to one file. Pass { file | code }, a required { output_path }, and { format }. Supported formats: stl (binary STL mesh), step (BREP CAD interchange), dxf (planar laser/waterjet profile from a Region or planar face), 3mf (slicer-friendly mesh with per-part colors), glb (web-viewer / AR with PBR materials), svg-drawing (third-angle engineering-drawing sheet: front/top/left + isometric views, hidden edges dashed, tangent edges thin, overall bounding-box dimensions, title block; assemblies are drawn with inter-part occlusion; pass options.annotations to dimension specific features instead of the bounding box; pass options.exploded { factor, mode } to explode the isometric cell, options.balloons to number parts from the BOM, and options.partsList for an item/name/qty/material table above the title block). overall bounding-box dimensions, title block; assemblies are drawn with inter-part occlusion; pass options.annotations to dimension specific features instead of the bounding box, options.autoAnnotate to derive datums A/B/C, grouped hole callouts with position tolerances, hole positions, overall size, radius and chamfer callouts, flatness and an ISO 2768 note from the geometry (the result carries drawing_report with placed / overlapped counts), and options.sections for real section views on any cutting plane). Robot descriptions: urdf (tree-topology robot description), srdf (motion-planning semantics layered over the URDF), sdf-gazebo (SDFormat 1.10 with native ball joints, closed loops, and solved per-link poses), usd-isaac (ASCII USD physics stage: PhysicsArticulationRootAPI root, one rigid body per link at its solved pose with mass / centre of mass / principal inertia, PhysicsFixedJoint/PhysicsRevoluteJoint/PhysicsPrismaticJoint per mate with token axis, two-sided joint frames and limits, UsdPreviewSurface materials from the part appearance, and joint drives only when declared in options.drives { : { stiffness, damping, maxForce?, targetPosition? } }; options.collisionApproximation is convexHull | convexDecomposition; planar/cylindrical/pin_slot/ball mates fail closed with export.usd.joint-unsupported). bom-csv / bom-json (bill of materials over assembly.model()/solvedModel(): one row per distinct part — grouped by geometry/catalog identity, not name — with real instance quantity, kind, material, density, mass, bbox, process hint, and catalog provenance for purchased parts; same numbers as inspect({ of: 'bom' })). urdf and sdf-gazebo also write one meshes/.stl per link, and usd-isaac one meshes/.usda mesh layer per link, next to output_path (reported in mesh_files) — ship the whole directory to the consumer. STL exports run a watertight verify by default; failures return ok: false with export.mesh.not-watertight (open-edge count + up to 5 crack-cluster locations) but the file is still written so the broken mesh can be inspected. Optional { feature_id } selects which feature to export (default: last). Optional { options } carries per-format options bag (see the kernelcad-mcp skill for the per-format keys: dxf layers/tolerance/unit, 3mf printUnit/embedSource, glb axis/draco).

  • target:'part' — export solved-assembly parts as individual binary STL files in their modeled (world-frame) positions. Pass { file | code }, plus { part, output_path } for one part or { output_dir } for all parts (files land at /.stl). A watertight verify runs on every exported mesh by default and fails the call with export.mesh.not-watertight; unknown part names fail with export.part.not-found listing the valid names. Pass { no_verify: true } to skip the watertight gate. All params except target are forwarded verbatim; each target fails closed on its own missing required params.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoInline kernelCAD script source.
fileNoPath to a .kcad.ts script file.
partNotarget:'part' — part name for single-part export, or 'all'.
formatNotarget:'model' — output file format (required for that target).
targetYesWhich exporter to run: 'model' (whole-script geometry to one file) or 'part' (per-part STLs from a solved assembly).
optionsNotarget:'model' — optional per-format options bag. Discriminator options.format must equal top-level format. dxf: { layers?, unit?: "mm"|"cm"|"in", tolerance? }. 3mf: { printUnit?: "mm"|"cm"|"in", embedSource? }. glb: { axis?: "y-up"|"z-up", draco?: false }. svg-drawing: { sheet?: "a4"|"a3", modelName?, date?, annotations?, exploded?: { factor, mode? }, balloons?, partsList?, sections?, autoAnnotate? }. svg-drawing annotations is an array of authored dimensions/notes, each { kind: "linear"|"radius"|"diameter"|"angular"|"note", view?: "front"|"top"|"left"|"iso", text?, offset? } plus kind-specific geometry: linear { from, to }, radius/diameter { edge: EdgeQuery }, angular { from: EdgeQuery, to: EdgeQuery }, note { at, text }. from/to/at anchors are an [x,y,z] model point, { edge: EdgeQuery } or { face: FaceQuery }. Supplying any annotation REPLACES the automatic bounding-box dimensions; an annotation whose query resolves to zero or multiple matches fails the export rather than being dropped. svg-drawing sections is an array of { plane: "xy"|"xz"|"yz"|{ origin, normal }, label } (any non-zero normal). svg-drawing autoAnnotate is true or { tolerance?: "ISO2768-f"|"ISO2768-m"|"ISO2768-c", datums?: "auto"|[{ label, face: FaceQuery }], include?: ["datums"|"flatness"|"holes"|"hole-positions"|"overall"|"fillets"|"chamfers"|"general-tolerance"] }; datums and tolerances declared in the script with shape.datum() / shape.tolerance() override the automatic ones.
no_verifyNoSkip the STL watertight verify gate.
feature_idNotarget:'model' — optional FeatureId to export; defaults to last.
output_dirNotarget:'part' — destination directory (all-parts mode); files are <dir>/<part>.stl.
output_pathNoDestination path. target:'model' — the export file (required). target:'part' — single-part .stl path.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo
formatNo
writtenNotarget:'part' — per-part export records.
byte_countNotarget:'model' — file size in bytes.
mesh_filesNoPer-link mesh files: meshes/<part>.stl for urdf/sdf-gazebo, meshes/<part>.usda mesh layers for usd-isaac.
diagnosticsNo
output_pathNotarget:'model' — written file path.
feature_countNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / format / enum
      Previous value: -[
      -  "stl",
      -  "step",
      -  "dxf",
      -  "3mf",
      -  "glb",
      -  "svg-drawing",
      -  "urdf",
      -  "srdf",
      -  "sdf-gazebo"
      -]New value: +[
      +  "stl",
      +  "step",
      +  "dxf",
      +  "3mf",
      +  "glb",
      +  "svg-drawing",
      +  "urdf",
      +  "srdf",
      +  "sdf-gazebo",
      +  "usd-isaac",
      +  "bom-csv",
      +  "bom-json"
      +]
    • changedInput schema / properties / options / description
      Previous value: -"target:'model' — optional per-format options bag. Discriminator options.format must equal top-level format. dxf: { layers?, unit?: \"mm\"|\"cm\"|\"in\", tolerance? }. 3mf: { printUnit?: \"mm\"|\"cm\"|\"in\", embedSource? }. glb: { axis?: \"y-up\"|\"z-up\", draco?: false }. svg-drawing: { sheet?: \"a4\"|\"a3\", modelName?, date? }."New value: +"target:'model' — optional per-format options bag. Discriminator options.format must equal top-level format. dxf: { layers?, unit?: \"mm\"|\"cm\"|\"in\", tolerance? }. 3mf: { printUnit?: \"mm\"|\"cm\"|\"in\", embedSource? }. glb: { axis?: \"y-up\"|\"z-up\", draco?: false }. svg-drawing: { sheet?: \"a4\"|\"a3\", modelName?, date?, annotations?, exploded?: { factor, mode? }, balloons?, partsList?, sections?, autoAnnotate? }. svg-drawing annotations is an array of authored dimensions/notes, each { kind: \"linear\"|\"radius\"|\"diameter\"|\"angular\"|\"note\", view?: \"front\"|\"top\"|\"left\"|\"iso\", text?, offset? } plus kind-specific geometry: linear { from, to }, radius/diameter { edge: EdgeQuery }, angular { from: EdgeQuery, to: EdgeQuery }, note { at, text }. from/to/at anchors are an [x,y,z] model point, { edge: EdgeQuery } or { face: FaceQuery }. Supplying any annotation REPLACES the automatic bounding-box dimensions; an annotation whose query resolves to zero or multiple matches fails the export rather than being dropped. svg-drawing sections is an array of { plane: \"xy\"|\"xz\"|\"yz\"|{ origin, normal }, label } (any non-zero normal). svg-drawing autoAnnotate is true or { tolerance?: \"ISO2768-f\"|\"ISO2768-m\"|\"ISO2768-c\", datums?: \"auto\"|[{ label, face: FaceQuery }], include?: [\"datums\"|\"flatness\"|\"holes\"|\"hole-positions\"|\"overall\"|\"fillets\"|\"chamfers\"|\"general-tolerance\"] }; datums and tolerances declared in the script with shape.datum() / shape.tolerance() override the automatic ones."
    • changedOutput schema / properties / mesh_files / description
      Previous value: -"Per-link mesh files for urdf/sdf-gazebo exports."New value: +"Per-link mesh files: meshes/<part>.stl for urdf/sdf-gazebo, meshes/<part>.usda mesh layers for usd-isaac."
  2. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "byte_count": {
      +      "description": "target:'model' — file size in bytes.",
      +      "type": "number"
      +    },
      +    "diagnostics": {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "error": {
      +      "type": "string"
      +    },
      +    "feature_count": {
      +      "type": "number"
      +    },
      +    "format": {
      +      "type": "string"
      +    },
      +    "mesh_files": {
      +      "description": "Per-link mesh files for urdf/sdf-gazebo exports.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "ok": {
      +      "type": "boolean"
      +    },
      +    "output_path": {
      +      "description": "target:'model' — written file path.",
      +      "type": "string"
      +    },
      +    "written": {
      +      "description": "target:'part' — per-part export records.",
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "ok"
      +  ],
      +  "type": "object"
      +}
  3. Added

TDQS

A4.8/5.0
Behavior5/5

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

The annotations provide only basic hints (not read-only, not destructive, open-world). The description goes far beyond this: it explicitly states that STL exports run a watertight verify by default and that failures still write the file, it lists which exports write sidecar mesh files (urdf, sdf-gazebo, usd-isaac), it documents failure codes (export.mesh.not-watertight, export.part.not-found), and it specifies that 'All params except `target` are forwarded verbatim; each target fails closed on its own missing required params.' This is rich behavioral context that is not present in the annotations.

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?

The description is long (about 340 words) but packed with necessary details for 12 formats and two targets. It is front-loaded with the core instruction and then organized in two clear blocks with bolded target names. The sentence on STL verify and failure modes is a bit dense, but every sentence adds required information. It earns its length given the complexity, though a shorter summary at the top and more bullet formatting could improve scannability. Still, it is well-structured for its size.

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?

Given the huge parameter count (10) and nested object schema, the description covers all critical usage aspects: target selection, required vs optional parameters per target, per-format nuances (meshes written, verify behavior, failure codes), and the interaction between `options.format` and top-level `format`. The output schema exists and is rich, and the description explains what happens when the export fails (file still written, error codes). Nothing an agent needs to decide whether to call this tool and how to fill parameters is missing, aside from trivial details that are already in the schema.

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?

The schema description coverage is 100%, and the schema descriptions already explain each parameter's purpose. The description adds meaning by linking all parameters to their target-specific behavior (e.g., `output_path` for model vs part, `output_dir` for all parts, `no_verify` to skip watertight gate) and by describing the required vs optional status for each target. It also clarifies that `options` is a per-format bag and includes detailed semantics for svg-drawing annotations, sections, autoAnnotate, and joint drives. This is more valuable than a simple schema list, though some schema descriptions already cover basics, so the description adds moderate-high value.

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?

The description starts with 'Use this when you need to export geometry to a file' and immediately introduces two distinct exporters selected by `target`, each with its own output format list, behavior, and file-writing details. It clearly differentiates from siblings like get_model_mesh (which fetches a mesh rather than writing files) and capture_animation (which records visual output). The resource (geometry/assembly) and action (export to file) are explicit, and the sub-modes are unambiguously specified.

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?

The description provides explicit when-to-use ('Use this when you need to export geometry to a file') and then for each target details the required parameters and failure modes. It names the main alternative for reading geometry (get_model_mesh) implicitly by focusing on file export, and it mentions `inspect` as an alternative for BOM data ('same numbers as inspect({ of: 'bom' })'). It also gives guidance on what not to do (e.g., for part export, unknown part names fail; for STL, watertight verify is default). Very strong usage routing.

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.