Skip to main content
Glama

Topology to Solid

topology_to_solid

Reconstructs a FreeCAD solid from a topology-optimization density field by thresholding solid cells, building boxes from 2D rows or 3D voxels, and returning volume and mass-fraction metrics.

Instructions

Reconstruct a FreeCAD solid from a topology-optimization density field — the modeller-side close of the loop opened by topology_optimize_submit, whose density this consumes. 2-D (nely×nelx grid): thresholds (a cell is solid when density ≥ threshold), run-length-merges each row into solid spans, tiles each span as a cell_mm box extruded thickness_mm in Z (row 0 at the top). 3-D (a nelz×nely×nelx voxel field from the nelz mode): greedy-merges solid voxels into maximal boxes at (i·cx, j·cy, k·cz) — j=0 at the bottom, thickness_mm ignored. Fuses into one static Part::Feature. cell_mm is a scalar or [cx, cy(, cz)] mm; thickness_mm defaults to the smaller cell edge; placement is an optional [x, y, z] mm origin offset; name names the object. Runs synchronously (it builds geometry — no jobs.py poll).

Returns {handle, name, volume (mm³), solid_cells, total_cells, mass_fraction (== solid_cells/total_cells — must be ≤ keep_fraction within one cell), n_solids (disjoint bodies; >1 means a split load path), threshold, nelx, nely, nelz (None for 2-D), bbox_mm}. Gate it with mass_properties (mass ≤ keep_fraction·original) and interference_check against keep-out regions, per SIMULATION_EXAMPLES §5.

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": {
      "density": "<density>"
    },
    "name": "topology_to_solid"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNo
cell_mmNo
densityYes
placementNo
thresholdNo
workspaceNoRun this call in this named workspace
thickness_mmNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.7
    • addedInput schema / properties / workspace
      Added value: +{
      +  "default": "",
      +  "description": "Run this call in this named workspace",
      +  "title": "Workspace",
      +  "type": "string"
      +}
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only say non-readonly/non-destructive; the description adds substantive behavior beyond that: it runs synchronously rather than via jobs.py polling, fuses output into one static Part::Feature, ignores `thickness_mm` in 3-D mode, and notes that n_solids > 1 signals a split load path. It also enumerates the full return payload, so the agent knows what it gets back without an output schema.

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?

Front-loaded with the core action and its upstream source, and nearly every clause carries information. It is dense and parenthetical-heavy (2-D vs 3-D algorithm details, return-field list), which makes it a long read, but no sentence is filler.

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?

No output schema exists, so the description fully enumerates the returned dict (handle, volume, solid_cells, mass_fraction, n_solids, bbox_mm, etc.) and even flags the mass_fraction ≤ keep_fraction invariant. Combined with the mode-specific behavior and the validation hand-off, an agent has everything needed to call and verify this correctly.

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?

With only 14% schema description coverage, the description carries the load well: it defines `threshold` as a ≥ comparison, `cell_mm` as a scalar or [cx, cy(, cz)] mm, `thickness_mm`'s default and its 3-D no-op, `placement` as an [x, y, z] mm origin offset, and `name`'s role. The one gap is the required `density` parameter's concrete nesting/ordering (list-of-rows vs flat) — 'nely×nelx grid' implies it but never states it outright.

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 ('Reconstruct a FreeCAD solid from a topology-optimization density field') and explicitly ties it to the sibling `topology_optimize_submit` whose `density` it consumes. An agent can distinguish it from the optimizer and from generic geometry builders without opening any 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?

Explicitly frames this as the downstream half of a two-step loop started by `topology_optimize_submit`, and prescribes the follow-up gating calls (`mass_properties`, `interference_check`) with the acceptance criterion (mass ≤ keep_fraction·original) and a documentation pointer (SIMULATION_EXAMPLES §5). It also disambiguates the 2-D vs 3-D modes by naming which upstream mode produces which field.

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