Skip to main content
Glama

repair_mesh

Destructive

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

NameRequiredDescriptionDefault
file_pathYesPath to the STL file to repair.
close_holesNoAlso close open holes and fix boundary edges (slower; default False). Default: false.
output_pathNoOutput path. Defaults to overwriting the input. Default: "".
weld_toleranceNoWeld radius in mm, as a string. Empty = Kiln's own tiny auto radius (removes float-rounding seams, never real gaps); "0" disables welding. Default: "".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.5.1
    • changedInput schema / properties / close_holes / description
      Previous value: -"Default: false."New value: +"Also close open holes and fix boundary edges (slower; default False). Default: false."
    • addedInput schema / properties / file_path / description
      Added value: +"Path to the STL file to repair."
    • changedInput schema / properties / output_path / description
      Previous value: -"Default: \"\"."New value: +"Output path.  Defaults to overwriting the input. Default: \"\"."
    • changedInput schema / properties / weld_tolerance / description
      Previous value: -"Default: \"\"."New value: +"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: \"\"."
  2. Changed6 schema fields changedv1.5.0
    • removedInput schema / properties / close_holes / default
      Removed value: -false
    • addedInput schema / properties / close_holes / description
      Added value: +"Default: false."
    • removedInput schema / properties / output_path / default
      Removed value: -""
    • addedInput schema / properties / output_path / description
      Added value: +"Default: \"\"."
    • removedInput schema / properties / weld_tolerance / default
      Removed value: -""
    • addedInput schema / properties / weld_tolerance / description
      Added value: +"Default: \"\"."
  3. Changed1 schema field changedv1.3.1
    • addedInput schema / properties / weld_tolerance
      Added value: +{
      +  "default": "",
      +  "title": "Weld Tolerance",
      +  "type": "string"
      +}
  4. Changed1 schema field changedv1.3.0
    • addedInput schema / properties / close_holes
      Added value: +{
      +  "default": false,
      +  "title": "Close Holes",
      +  "type": "boolean"
      +}
  5. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true, and the description makes the destruction concrete: output_path defaults to overwriting the input. Beyond that it discloses reversible-failure semantics (closures that collapse volume are rolled back with the reason in unrepaired), refusal behavior for redundant sewing, and automatic decimation of oversized meshes for the stage. That is substantive behavioral disclosure on top of 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?

Purpose is front-loaded in the first sentence and the paragraphs follow a logical order: passes, safety/rollback, return contract, params. It is on the long side and repeats the welding rationale at some length, and the inline-3D-stage paragraph is presentational boilerplate rather than task-relevant information.

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?

With no output schema, the description carries the return contract and does so thoroughly: is_watertight semantics, remaining boundary/pinch edge counts, enclosed_volume_mm3, and the unrepaired list with an explicit instruction to read it before reporting success. For a destructive 4-parameter repair tool, nothing an agent needs in order to call it and interpret the result is missing.

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, but the description adds real meaning: weld_tolerance distinguishes empty (auto radius that removes rounding seams but 'never real gaps') from "0" (disables welding), which the schema does not convey. close_holes is explained as a slower deep pass tied to a watertightness condition. Only output_path gets no added signal beyond the schema.

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?

Opens with a specific verb and resource plus an enumerated defect taxonomy ('rounding-noise seams, degenerates, holes'), so the agent knows exactly what class of operation this is. It also implicitly separates itself by stating what it cannot fix (pinched edges, which are 'not holes and cannot be sewn'). It never names a sibling tool (e.g. diagnose_mesh or remove_mesh_floating_regions) as the alternative for those cases, so it stops short of full sibling differentiation.

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

Usage Guidelines4/5

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

Gives concrete triggers: welding is the right fix for scanned/AI-generated float jitter, and close_holes=True is for meshes that are 'not watertight'. It also routes the user out for unfixable defects ('must be fixed where the geometry was made'). Clear context, but no explicit named alternative tool for diagnosing before repairing.

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

Deploy Server

Other Tools