Skip to main content
Glama

Run Structural FEA

run_fea

Use this when you need to know whether a part will hold a load. Runs a linear-static structural study and returns evidence — peak von Mises stress (MPa), peak displacement (mm), the minimum safety factor against the material yield (taken away from the clamp-singular edges of the fixed faces; the raw clamp-edge peak is reported separately as peakAtSupportMPa), per-region hot spots named by @kc[...] face ref, mesh trust flags, an equilibrium residual, and (CalculiX only) stress-heatmap PNG paths. The study is EITHER declared in the script with shape.feaStudy({ material, fixed, loads, meshSize?, minSafetyFactor? }) OR passed on the call against the shape the script returns: { code: 'return box(100, 20, 10);', material: 'aluminum-6061', fixed: { atX: 0 }, loads: [{ faces: { atX: 100 }, force: [0, 0, -200] }] }. Faces are a FaceQuery ({ atX | atY | atZ, byNormal: 'Z', ofSurfaceType, near: [x,y,z], ... }; with near it names the ONE matching face nearest the point), a face label ('top', 'bottom', 'left', 'right', 'front', 'back'; it must name ONE face — after a boolean 'top' can be several, which is an error listing them) or an @kc[...] ref. Force is the TOTAL [Fx, Fy, Fz] in N on those faces (a scalar force + direction is accepted). Materials: mild-steel, aluminum-6061, pla, petg, abs, asa, nylon (aliases steel, aluminum), or { E, nu, yield } in MPa. Solver (solver, default 'auto'): CalculiX + gmsh quadratic tets when that toolchain is installed; otherwise the built-in in-process voxel solver (8-node incompatible-mode bricks), which needs nothing installed and is marked summary.solver 'in-process-voxel' with trust.meshTrusted false — an estimate (accurate for prismatic bending, approximate at curved faces and notches), never a verified pass. solver: 'calculix' fails up front with fea.solver.unavailable and the install command when the toolchain is absent. Also: study (a declared study name; default the last), output_dir (keeps the deck / summary JSON), mesh_size (mm, overrides the study for this run), heatmaps: false for a numbers-only run. CalculiX mesh refinement is automatic: when the stress is untrusted only because the solver's error estimate is high, it re-solves once at 0.75x the element size (inside the element budget), with summary.refinement listing each pass. refine: false solves once.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "run_fea"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNoInline kernelCAD script source (mutually exclusive with file).
fileNoPath to a .kcad.ts script declaring at least one feaStudy. Hosted: `code`, `project:<slug>` (head), or a Studio `/p/<slug>?version=N` link (pinned); no local files.
fixedNoInline study: faces held fixed — a FaceQuery like { atX: 0 }, a face label like 'bottom', or an @kc[...] ref.
loadsNoInline study: loads, each { faces, force: [Fx, Fy, Fz] } — total force in N on those faces.
studyNoName of the declared study to run; defaults to the last declared one.
refineNoOne automatic finer pass (0.75x element size) when the stress is untrusted, inside the element budget (default true). false: one solve at mesh_size.
solverNo'auto' (default): CalculiX when installed, else in-process. 'calculix': require it. 'in-process': always the built-in voxel solver.
heatmapsNoRender stress heatmap PNGs (default true).
materialNoInline study: material grade name (e.g. 'aluminum-6061') or { E, nu, yield } in MPa.
mesh_sizeNoTarget element size in mm, overriding the study for this run.
output_dirNoDirectory for the solver deck, results, summary JSON and heatmap PNGs.
mesh_timeout_msNoWall-clock budget for meshing (default 120000).
solve_timeout_msNoWall-clock budget for the solve (default 300000).
min_safety_factorNoInline study: required minimum safety factor; below it the call fails with fea.safety-factor.below-min.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / file / description
      Previous value: -"Path to a .kcad.ts script declaring at least one feaStudy. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."New value: +"Path to a .kcad.ts script declaring at least one feaStudy. Hosted: `code`, `project:<slug>` (head), or a Studio `/p/<slug>?version=N` link (pinned); no local files."
  2. Changed2 schema fields changed
    • addedInput schema / properties / fixed / type
      Added value: +[
      +  "string",
      +  "object"
      +]
    • addedInput schema / properties / material / type
      Added value: +[
      +  "string",
      +  "object"
      +]
  3. Changed6 schema fields changed
    • addedInput schema / properties / fixed
      Added value: +{
      +  "description": "Inline study: faces held fixed — a FaceQuery like { atX: 0 }, a face label like 'bottom', or an @kc[...] ref."
      +}
    • addedInput schema / properties / loads
      Added value: +{
      +  "description": "Inline study: loads, each { faces, force: [Fx, Fy, Fz] } — total force in N on those faces.",
      +  "items": {
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / material
      Added value: +{
      +  "description": "Inline study: material grade name (e.g. 'aluminum-6061') or { E, nu, yield } in MPa."
      +}
    • addedInput schema / properties / min_safety_factor
      Added value: +{
      +  "description": "Inline study: required minimum safety factor; below it the call fails with fea.safety-factor.below-min.",
      +  "type": "number"
      +}
    • addedInput schema / properties / solver
      Added value: +{
      +  "description": "'auto' (default): CalculiX when installed, else in-process. 'calculix': require it. 'in-process': always the built-in voxel solver.",
      +  "enum": [
      +    "auto",
      +    "calculix",
      +    "in-process"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / study / description
      Previous value: -"Name of the study to run; defaults to the last declared one."New value: +"Name of the declared study to run; defaults to the last declared one."
  4. Changed2 schema fields changed
    • removedOutput schema / properties
      Removed value: -{
      -  "artifacts": {
      -    "additionalProperties": true,
      -    "description": "Absolute paths of the BREP geometry handoff, .inp deck, .frd results and mesh JSON, for hand reproduction.",
      -    "type": "object"
      -  },
      -  "diagnostics": {
      -    "description": "fea.* diagnostics raised by the run.",
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "error": {
      -    "type": "string"
      -  },
      -  "errorCode": {
      -    "type": "string"
      -  },
      -  "images": {
      -    "description": "Absolute PNG paths of the rendered stress heatmap.",
      -    "items": {
      -      "type": "string"
      -    },
      -    "type": "array"
      -  },
      -  "legend": {
      -    "description": "Heatmap colour bands { color, fromMPa, toMPa } — the scale the PNGs are drawn on.",
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "ok": {
      -    "description": "False when the study violated its declared minSafetyFactor, a selector did not resolve, or the solver toolchain is missing.",
      -    "type": "boolean"
      -  },
      -  "out_dir": {
      -    "description": "Directory holding the summary JSON, solver deck and heatmap PNGs.",
      -    "type": "string"
      -  },
      -  "summary": {
      -    "additionalProperties": true,
      -    "description": "Solved evidence: maxVonMisesMPa, maxVonMisesAt, maxDisplacementMm, maxDisplacementAt, minSafetyFactor (+ minSafetyFactorRequired), nodeCount/elementCount/meshSizeMm, quality (minSICN, meanSICN, lowQualityCount), maxStressErrorPercent (high-stress region), trust { meshTrusted, reasons }, hotSpots [{ region, maxVonMisesMPa, nodeId, at, safetyFactor }]; the stress values, safety factor and hot spots exclude the support zone next to fixed-face edges (governingField), whose clamp-singular raw peak is reported as peakAtSupportMPa / peakAtSupportAt / peakAtSupportRegion with supportAdjacentNodeCount and supportZoneRadiusMm; appliedForceN / reactionForceN / equilibriumResidual, meshMs / solveMs.",
      -    "type": "object"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok"
      -]
  5. Changed1 schema field changed
    • changedInput schema / properties / refine / description
      Previous value: -"Automatic mesh refinement until the stress is trusted, inside the element and wall-time budgets (default true). false: one solve at mesh_size."New value: +"One automatic finer pass (0.75x element size) when the stress is untrusted, inside the element budget (default true). false: one solve at mesh_size."
  6. Changed1 schema field changed
    • addedInput schema / properties / refine
      Added value: +{
      +  "description": "Automatic mesh refinement until the stress is trusted, inside the element and wall-time budgets (default true). false: one solve at mesh_size.",
      +  "type": "boolean"
      +}
  7. Changed1 schema field changed
    • changedOutput schema / properties / summary / description
      Previous value: -"Solved evidence: maxVonMisesMPa, maxVonMisesAt, maxDisplacementMm, maxDisplacementAt, minSafetyFactor (+ minSafetyFactorRequired), nodeCount/elementCount/meshSizeMm, quality (minSICN, meanSICN, lowQualityCount), maxStressErrorPercent, trust { meshTrusted, reasons }, hotSpots [{ region, maxVonMisesMPa, nodeId, at, safetyFactor }], appliedForceN / reactionForceN / equilibriumResidual, meshMs / solveMs."New value: +"Solved evidence: maxVonMisesMPa, maxVonMisesAt, maxDisplacementMm, maxDisplacementAt, minSafetyFactor (+ minSafetyFactorRequired), nodeCount/elementCount/meshSizeMm, quality (minSICN, meanSICN, lowQualityCount), maxStressErrorPercent (high-stress region), trust { meshTrusted, reasons }, hotSpots [{ region, maxVonMisesMPa, nodeId, at, safetyFactor }]; the stress values, safety factor and hot spots exclude the support zone next to fixed-face edges (governingField), whose clamp-singular raw peak is reported as peakAtSupportMPa / peakAtSupportAt / peakAtSupportRegion with supportAdjacentNodeCount and supportZoneRadiusMm; appliedForceN / reactionForceN / equilibriumResidual, meshMs / solveMs."
  8. Changed1 schema field changed
    • changedInput schema / properties / file / description
      Previous value: -"Path to a .kcad.ts script declaring at least one feaStudy."New value: +"Path to a .kcad.ts script declaring at least one feaStudy. Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
  9. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.