Skip to main content
Glama
pzfreo

build123d-mcp

health_check

Verifies render and export dependencies by testing PNG, SVG, STEP, and STL outputs. Returns JSON with pass/fail status for each capability.

Instructions

Verify that render and export dependencies are working. Tests PNG render (VTK), SVG render (build123d HLR), STEP export, and STL export with a trivial shape. Returns JSON with ok/error per capability. Run at session start if you suspect a missing dependency.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function that performs the health check. It tests PNG render (VTK), SVG render (HLR projection), STEP export, and STL export with a trivial Box shape, returning JSON with ok/error per capability.
    def health_check(_session) -> str:
        results: dict = {}
    
        # PNG render (VTK + display)
        try:
            from build123d import Box
            from build123d_mcp.tools.render import _QUALITY, _do_render_png
            img_bytes, _warnings = _do_render_png([("test", Box(1, 1, 1), None)], _QUALITY["standard"], "iso", "", None, 0.0, 0.0)
            results["render_png"] = {"ok": True, "bytes": len(img_bytes)}
        except Exception as e:
            results["render_png"] = {"ok": False, "error": str(e)}
    
        # SVG render (build123d HLR projection)
        try:
            from build123d import Box
            from build123d_mcp.tools.render import _do_render_svg
            svg = _do_render_svg([("test", Box(1, 1, 1), None)], "iso", "", None, 0.0, 0.0)
            results["render_svg"] = {"ok": True, "bytes": len(svg)}
        except Exception as e:
            results["render_svg"] = {"ok": False, "error": str(e)}
    
        # STEP export
        try:
            from build123d import Box, export_step
            fd, path = tempfile.mkstemp(suffix=".step")
            os.close(fd)
            export_step(Box(1, 1, 1), path)
            results["export_step"] = {"ok": True, "bytes": os.path.getsize(path)}
            os.unlink(path)
        except Exception as e:
            results["export_step"] = {"ok": False, "error": str(e)}
    
        # STL export
        try:
            from build123d import Box, Mesher
            fd, path = tempfile.mkstemp(suffix=".stl")
            os.close(fd)
            m = Mesher()
            m.add_shape(Box(1, 1, 1))
            m.write(path)
            results["export_stl"] = {"ok": True, "bytes": os.path.getsize(path)}
            os.unlink(path)
        except Exception as e:
            results["export_stl"] = {"ok": False, "error": str(e)}
    
        results["ok"] = all(v["ok"] for v in results.values() if isinstance(v, dict) and "ok" in v)
        return json.dumps(results, indent=2)
  • MCP tool registration via @mcp.tool() decorator. The server-level health_check() delegates to _session.health_check().
    @mcp.tool()
    def health_check() -> str:
        """Verify that render and export dependencies are working. Tests PNG render (VTK), SVG render (build123d HLR), STEP export, and STL export with a trivial shape. Returns JSON with ok/error per capability. Run at session start if you suspect a missing dependency."""
        return _session.health_check()
  • Worker dispatch: routes the 'health_check' operation string to the health_check function from tools/health_check.py.
    if op == "health_check":
        from build123d_mcp.tools.health_check import health_check
        return health_check(session)
  • WorkerSession.health_check() method that sends a 'health_check' RPC call with RENDER_TIMEOUT.
    def health_check(self) -> str:
        return self._call("health_check", {}, self._RENDER_TIMEOUT)
  • Test for health_check: verifies it returns valid JSON with all expected keys (ok, export_step, export_stl, render_svg) and that export checks pass.
    def test_health_check_returns_json(session):
        data = json.loads(health_check(session))
        assert "ok" in data
        assert "export_step" in data
        assert "export_stl" in data
        assert "render_svg" in data
        assert data["export_step"]["ok"] is True
        assert data["export_stl"]["ok"] is True
        assert data["render_svg"]["ok"] is True
Behavior4/5

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

No annotations provided, but description discloses tests using a trivial shape and JSON return with ok/error per capability. Could mention no side effects, but sufficient for a health check.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, each earning its place: purpose, details, usage guidance. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no parameters and existence of output schema, description covers purpose, capabilities tested, and return format. Could add behavior on error, but sufficient.

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?

Zero parameters, schema coverage 100%, baseline score 4. Description adds no param info, which is appropriate.

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?

Description clearly states it verifies render and export dependencies, lists specific capabilities (PNG, SVG, STEP, STL), and distinguishes from siblings as no other tool performs dependency checks.

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?

Explicitly advises running at session start when a missing dependency is suspected, but does not mention when not to use it or alternatives, though no obvious alternative exists.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pzfreo/build123d-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server