Skip to content

Append basic geometry metrics to successful execute() responses #448

Description

@pzfreo

From a comparison with Casys-AI/mcp-build123d: their build123d_execute returns exact analytical metrics from the OCCT kernel on every run — volume, bounding box, surface area, and mass/center of gravity whenever a density is specified — without the client needing a second tool call.

Our execute() success path (tools/execute.py::execute_code) appends a Session objects: summary but no numbers; the assistant must follow up with measure() to learn anything quantitative. Since the recommended loop is "build one feature, then verify", nearly every execute is followed by a measure anyway — folding a lightweight metrics line into the execute envelope would save a round-trip per step and nudge assistants that skip verification into noticing when a boolean silently produced 0 mm³.

Suggested scope:

  • On success, when current_shape is a 3D shape, append one line with bounding box and volume (e.g. current_shape: bbox 60.0 x 40.0 x 6.0 mm, volume 13,608 mm³); topology-light so it stays fast on heavy models
  • Reuse the measure() machinery — measure(): add density parameter / material presets to report mass and physical inertia #237 already added density/material there; if a session-level density/material has been set, include mass too
  • Keep it out of error responses (those already carry hints + failure classification)
  • Possibly a CLI/env switch to disable it if the extra computation is unwanted on huge models

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions