Skip to main content
Glama
freecad-mcp

freecad-mcp

run_fem_analysis

Runs CalculiX FEA on an existing FreeCAD Fem::AnalysisPython container and returns max von Mises stress, displacements, node count, and solver working directory.

Instructions

Run the CalculiX solver on an existing Fem::FemAnalysis container and return summary results.

Prerequisites in the document, all created with create_object:

  • A Part-derived solid (e.g. Part::Box, PartDesign::Body) acting as the geometry.

  • A Fem::AnalysisPython container.

  • A material: type "Fem::MaterialCommon" with analysis_name set (built with ObjectsFem.makeMaterialSolid) and its Material given as a dict with units, e.g. {"Name": "Steel", "YoungsModulus": "210 GPa", "PoissonRatio": "0.3", "Density": "7900 kg/m^3"}. A dict read from the material library can come back empty; give the values.

  • A mesh: type "Fem::FemMeshGmsh" with analysis_name, Shape (the geometry) and CharacteristicLengthMax / CharacteristicLengthMin; it is generated when created. A section needs several elements across its thickness, or bending stress comes out far too low.

  • At least one Fem::ConstraintFixed and one Fem::ConstraintForce (or ConstraintPressure) whose References are faces of the geometry.

  • Set Force with its unit, e.g. "1000 N": create_object/edit_object reject unitless values. In existing documents and execute_code, a plain number uses millinewtons, so Force = 1000 applies 1 N. The force acts along the normal of the loaded face unless Direction links an edge or face; Reversed flips it.

A SolverCcxTools is auto-created if the analysis has none. The reply lists mechanical loads captured in the same GUI operation as the solve (in N and MPa, with faces and direction). A failed load read stops the solve. Direction can be set to {"object_name": "Beam", "edge": "Edge1"}.

The solver runs synchronously on the FreeCAD GUI thread. Other document operations queue behind it; get_rpc_status and get_async_status remain available.

Returns max von Mises stress (MPa), max/min displacement (mm), node count, and the working directory CalculiX wrote to. On failure, returns the prerequisite-check or solver error along with the working directory for triage.

Args: doc_name: Name of the FreeCAD document. analysis_name: Name of the Fem::AnalysisPython object. timeout: Seconds to wait for the solver (default 600). include_screenshot: Whether to return a screenshot of the model (default True). Set to False to save tokens when only the numeric results are needed. view_name: The view orientation of the returned screenshot (default "Isometric").

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": {
      "doc_name": "<doc_name>",
      "analysis_name": "<analysis_name>"
    },
    "name": "run_fem_analysis"
  }
}

Input Schema

NameRequiredDescriptionDefault
timeoutNo
doc_nameYes
view_nameNoIsometric
analysis_nameYes
include_screenshotNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.32

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses that the solve is synchronous on the GUI thread, that other document operations queue behind it while get_rpc_status/get_async_status stay available, that a SolverCcxTools is auto-created, and that a failed load read aborts the solve. It also documents non-obvious semantics such as unitless Force meaning millinewtons in execute_code contexts and Direction targeting via edge/face objects.

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?

Long but front-loaded and dense: purpose first, then prerequisites, then runtime behavior, then return values, then args. Every block adds information an agent could not get from the schema, and the single-line arg annotations avoid re-explaining structured fields.

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?

For a complex, multi-prerequisite solver invocation with no output schema and no annotations, the description supplies the return shape (max von Mises stress in MPa, max/min displacement in mm, node count, working directory) and error behavior. The only shortfall is that specific solver failure modes and the exact meaning of the captured mechanical-loads summary are described loosely.

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 coverage is 0%, so the description must compensate, and it does: doc_name, analysis_name, timeout (default 600 s), include_screenshot (with the explicit token-saving rationale for setting it False) and view_name are all explained. The enum values for view_name are only in the schema, but the description's "view orientation of the returned screenshot" frames their purpose adequately.

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?

Names a specific verb and resource — "Run the CalculiX solver on an existing Fem::FemAnalysis container and return summary results" — which no sibling (create_object, execute_code, get_view) could be confused with. The scope (existing analysis container, summary results) is stated up front.

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?

The prerequisites block is effectively a use-case gate: it lists the exact document state (Part solid, Fem::AnalysisPython, material with analysis_name and unit-bearing dict, Fem::FemMeshGmsh with characteristic lengths, ConstraintFixed plus ConstraintForce/Pressure) required before calling. What is missing is explicit routing versus alternatives such as execute_code or execute_code_headless for FEM setup, though the callback to create_object for prerequisites is helpful.

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