repair_mesh
Fixes mesh defects by welding float-rounding seams, removing degenerate triangles, and recomputing normals; enable close_holes to seal small holes and make non-watertight meshes watertight.
Instructions
Repair mesh defects: rounding-noise seams, degenerates, holes.
Every pass first welds vertices that sit on the same point to
within rounding noise — scanned and AI-generated meshes
routinely carry float rounding jitter that reads as thousands of
phantom open edges, and welding is the honest fix for those. The
default pass then removes zero-area triangles and recomputes face
normals. Pass ``close_holes=True`` for the deep pass, which
additionally finds boundary edges (edges shared by only one
triangle) and closes small holes via fan triangulation — use it
when the mesh is not watertight.
Hole closing refuses rather than ruins: sewing triangles that
merely re-stamp existing surface are discarded, and a closure
that collapses the enclosed volume is rolled back with the
reason in ``unrepaired``.
The result states the output's actual condition: ``is_watertight``
(which also refuses to certify a sheet-cancelling zero-volume
surface), remaining boundary/pinch edge counts,
``enclosed_volume_mm3`` when the surface closes up, and — when
defects survive the pass — an ``unrepaired`` list saying which
defect classes this tool has no repair for (pinched edges, where
3+ triangles meet along one line, are not holes and cannot be
sewn; they must be fixed where the geometry was made). Read
``unrepaired`` before telling the user the mesh is fixed.
:param file_path: Path to the STL file to repair.
:param output_path: Output path. Defaults to overwriting the input.
:param close_holes: Also close open holes and fix boundary edges
(slower; default False).
:param weld_tolerance: Weld radius in mm, as a string. Empty =
Kiln's own tiny auto radius (removes float-rounding seams,
never real gaps); "0" disables welding.
:returns: Dict with repair statistics and residual-defect report.INLINE 3D STAGE: on success this tool opens Kiln's interactive 3D stage — an inline viewer panel the user can orbit, zoom, and turn over — in hosts that render MCP Apps panels (Kiln's hosted connection attaches a browser stage link for hosts that don't). Oversized meshes are decimated automatically for the stage; the PNG preview is the floor, not the whole experience.
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": {
"file_path": "<file_path>"
},
"name": "repair_mesh"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the STL file to repair. | |
| close_holes | No | Also close open holes and fix boundary edges (slower; default False). Default: false. | |
| output_path | No | Output path. Defaults to overwriting the input. Default: "". | |
| weld_tolerance | No | Weld radius in mm, as a string. Empty = Kiln's own tiny auto radius (removes float-rounding seams, never real gaps); "0" disables welding. Default: "". |