kratos-mcp-server

v0.10.0
kratos-mcp-server Checked 1 hour ago Published 1 month ago

MCP server for Kratos Multiphysics: scaffold, run and post-process finite element simulations

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

kratos_check_installation

Check that Kratos Multiphysics is available and report version, paths, thread count and the list of compiled applications.

kratos_install

Install Kratos Multiphysics via pip into this server's own Python environment -- a local compiled build (KRATOS_ROOT) is not required. Installs the 'KratosMultiphysics' core plus any named applications (e.g. ["StructuralMechanicsApplication", "ConvectionDiffusionApplication", "LinearSolversApplication"]); pass all=true instead for the 'KratosMultiphysics-all' omnibus package covering essentially every application. Official wheels are only published for Linux and Windows x86_64 -- there is no Kratos wheel for macOS, where a local K…

ParameterTypeDescription
allboolean
applications
upgradeboolean

kratos_list_applications

List all Kratos applications found in the source tree, flagging which ones are compiled (importable) in the current build.

kratos_list_elements

List element type names registered in Kratos (parsed from KRATOS_REGISTER_ELEMENT macros in the C++ sources). Optionally filter by application name (e.g. 'StructuralMechanicsApplication') or by a substring of the element name (e.g. 'SmallDisplacement').

ParameterTypeDescription
application
name_filter

kratos_list_conditions

List condition type names registered in Kratos (surface/line/point conditions used for loads and boundary terms), with optional filters as in kratos_list_elements.

ParameterTypeDescription
application
name_filter

kratos_list_constitutive_laws

List constitutive law names registered in Kratos (material models such as LinearElastic3DLaw or Newtonian2DLaw), with optional filters as in kratos_list_elements.

ParameterTypeDescription
application
name_filter

kratos_list_variables

List Kratos variables (DISPLACEMENT, TEMPERATURE, ...) grouped by type (double, array_1d_3, bool, ...), introspected from the live build. type_filter selects one group; name_filter is a substring.

ParameterTypeDescription
name_filter
type_filter

kratos_get_variable_info

Look up specific Kratos variables by name in the live build: whether each exists and its type (double, array_1d_3, bool, int, vector, matrix, string, flags ...). Vector components such as DISPLACEMENT_X resolve to their array variable ('component_of'). Use it to check names before putting them in ProjectParameters (variable_name, output variables, nodal_solution_step_data_variables).

ParameterTypeDescription
names *array

kratos_list_solvers

List the known solver_type values per analysis type (structural, thermal, fluid, potential_flow) together with the Python solver module implementing each, plus all *_solver.py modules found in the application source tree.

ParameterTypeDescription
analysis_type

kratos_list_processes

List Python process modules (boundary conditions, loads, output, utilities) discoverable in the Kratos source tree. These are the values usable as 'python_module' in ProjectParameters process lists. With with_defaults=true, each entry also carries the process' default_settings and param_types parsed from its source (best effort; modules whose defaults cannot be parsed are still listed without them). Use kratos_get_process_defaults for a single module's full schema.

ParameterTypeDescription
application
name_filter
with_defaultsboolean

kratos_get_process_defaults

Return a Kratos process' default settings -- parameter names, default values, coarse types (bool/number/string/array/json/null) and which parameters are model-part references -- parsed from its Python source' ValidateAndAssignDefaults block. This is the schema you need to author a process block in a ProjectParameters process list. python_module is a value from kratos_list_processes (e.g. 'assign_scalar_variable_process', 'vtk_output_process'). Returns {"error": ...} when the Kratos source is unavailable, the module is not found, o…

ParameterTypeDescription
python_module *string

kratos_get_solver_defaults

Return the complete default solver_settings parameters for a solver, as reported by its GetDefaultParameters(). analysis_type is one of structural/thermal/fluid/potential_flow; solver_type one of the values from kratos_list_solvers (e.g. 'Static', 'transient', 'Monolithic').

ParameterTypeDescription
analysis_type *string
solver_type *string

list_templates

List the available case templates (structural_static, thermal_transient, fluid_transient, ...) with their descriptions, required applications and placeholder defaults.

create_project_parameters

Generate a ProjectParameters.json from a template (see list_templates). overrides replaces placeholder defaults, e.g. {"end_time": 2.0, "fix_model_part": "Structure.left"}. When output_file is given the JSON is written there; the content is always returned.

ParameterTypeDescription
template *string
output_file
overrides

list_material_presets

List the curated material presets usable as 'preset' in create_materials. Each carries a constitutive_law name and default Variables for a physical material model (linear elastic, Von Mises plasticity, isotropic damage, Newtonian fluid). Cross-check law names with kratos_list_constitutive_laws for your compiled build.

list_linear_solver_presets

List curated linear_solver_settings presets (serial: sparse_lu, skyline_lu, amgcl, cg, bicgstab; MPI/Trilinos: amgcl_mpi, amesos, aztec, ml). Each 'settings' block is a drop-in for solver_settings.linear_solver_settings in a ProjectParameters.

create_materials

Write a Kratos Materials.json. Each entry needs 'model_part_name' (e.g. 'Structure.domain'). Provide either a 'preset' (a name from list_material_presets, which fills constitutive_law + default variables) or an explicit 'constitutive_law' (e.g. 'LinearElasticPlaneStrain2DLaw') plus 'variables' (e.g. {"YOUNG_MODULUS": 2.1e11}). With a preset, any 'variables' you pass override the preset's defaults; 'constitutive_law' is optional (thermal problems have none).

ParameterTypeDescription
materials *array
output_file *string

create_project

Scaffold a complete Kratos case directory from a template: ProjectParameters.json + Materials.json (+ optionally a small demo rectangle mesh wired to the template defaults, so the case runs out of the box). Returns the created file paths and next steps.

ParameterTypeDescription
directory *string
template *string
create_demo_meshboolean
namestring
overrides

create_multistage_project

Scaffold a Kratos multi-stage (orchestrated) case that chains several analyses in sequence, e.g. a continuation run or a coupled workflow where a later physics reads fields the earlier one wrote on the same mesh. Each element of 'stages' is {"name": "<stage_id>", "template": "<template>", "overrides": {...}} (overrides optional). Stages are composed via Kratos' SequentialOrchestrator (orchestrator + stages + execution_list) and run with run_simulation like any case. Mesh sharing: the first stage imports its mesh (mdpa); a later s…

ParameterTypeDescription
directory *string
stages *array
create_demo_meshboolean
namestring
stage_checkpointsboolean

create_cosim_project

Scaffold a CoSimulation (coupled-solver) case: several solvers exchanging interface data inside every time step, run with run_simulation like any case (the runner drives it through CoSimulationAnalysis). Needs KratosCoSimulationApplication. 'solvers' is a list of {"name", "type", "data", "parameters"?, "input_file"?}. 'type' is a CoSimulation wrapper module ('solver_wrappers.kratos.structural_mechanics_wrapper', ...) or the shorthands 'sdof' / 'sdof_static' (Python-only single-degree-of-freedom solvers: no mesh, ideal for learnin…

ParameterTypeDescription
couplings *array
directory *string
solvers *array
convergence_accelerators
convergence_criteria
coupled_solverstring
data_transfer_operators
end_timenumber
num_coupling_iterationsinteger
order
start_timenumber

create_fsi_project

Scaffold a partitioned fluid-structure interaction (FSI) case with Kratos' FSIApplication: a 2D channel [0,length]x[0,fluid_height] whose floor is an elastic block [0,length]x[-wall_thickness,0]. The fluid (monolithic Navier-Stokes, inlet velocity ramped over 'ramp_time', outlet pressure 0) loads the wall through the shared 'Interface'; the deformed wall moves the fluid mesh (ALE, mesh_solver_structural_similarity). Fluid and wall meshes are generated with DIFFERENT interface discretizations ('fluid_divisions' [nx, ny] triangles, 'wall_di…

ParameterTypeDescription
directory *string
acceleratorstring
coupling_tolerancenumber
dynamic_structureboolean
end_timenumber
fluid_densitynumber
fluid_divisions
fluid_heightnumber
fluid_viscositynumber
inlet_velocitynumber
lengthnumber
max_coupling_iterationsinteger
output_intervalinteger
poisson_rationumber
ramp_timenumber
time_stepnumber
wall_densitynumber
wall_divisions
wall_thicknessnumber
young_modulusnumber

add_boundary_condition

Insert a boundary condition / load process block into an existing ProjectParameters.json. kind is one of: fix_displacement, prescribed_displacement, fix_velocity, inlet_velocity, outlet_pressure, fix_temperature, point_load, line_load, surface_load, pressure_load, surface_heat_flux, volume_heat_source, self_weight, or the generic fix_scalar / assign_scalar / fix_vector / assign_vector (which need 'variable', e.g. DISTANCE). fix_* constrain the DOFs, assign_* only set the values. Loads with modulus+direction (point/line/surface_load,…

ParameterTypeDescription
kind *string
model_part *string
parameters_file *string
direction
interval
modulus
process_list
stage
value
variable

add_output_process

Add an output process to a ProjectParameters.json. format: 'vtk' (ParaView files, needs output_path), 'json' (time series of variables to a JSON file, needs output_file), or 'point' (probe variables at a coordinate, needs position and output_file). variables defaults to the ones already used elsewhere in the file or ["DISPLACEMENT"].

ParameterTypeDescription
parameters_file *string
formatstring
model_part
output_file
output_pathstring
position
variables

add_remeshing_process

Add an MMG remeshing process (MeshingApplication's mmg_process) to a ProjectParameters.json so the mesh is adapted while the case runs. strategy 'hessian' adapts to the second derivatives of the nodal scalar solution variable 'variable' (e.g. TEMPERATURE); 'levelset' refines around the zero of the signed-distance variable 'variable' (its GRADIENT variable must exist in the model part, e.g. via the solver's auxiliary_variables_list). Without min_size/max_size the sizes are derived from the current mesh. The mesh is remeshed ONCE at setup,…

ParameterTypeDescription
parameters_file *string
freeze_sub_model_parts
max_size
min_size
model_part
strategystring
variable

validate_project_parameters

Validate a ProjectParameters.json: JSON syntax, required keys, referenced files (mesh, materials) exist, model part names match the mesh submodelparts, and (deep=true, needs Kratos) the solver_settings against the solver's GetDefaultParameters().

ParameterTypeDescription
parameters_file *string
deepboolean

mdpa_inspect

Inspect a Kratos .mdpa mesh file: node/element/condition counts by type, bounding box, property ids and the SubModelPart tree with entity counts.

ParameterTypeDescription
path *string

mdpa_validate

Validate a .mdpa file: dangling node/element/condition references and empty submodelparts (pure-Python lint). With deep=true the file is additionally round-tripped through the real Kratos ModelPartIO.

ParameterTypeDescription
path *string
deepboolean

mdpa_create_structured_mesh

Generate a structured mesh and write it as .mdpa. kind: 'line' (size=[L], divisions=[n], submodelparts start/end), 'rectangle' (size=[W,H], divisions=[nx,ny], edge parts left/right/bottom/top, quads or triangles), or 'box' (size=[Lx,Ly,Lz], divisions=[nx,ny,nz], hexahedra, face parts xmin/xmax/ymin/ymax/zmin/zmax). All variants include a 'domain' submodelpart with every node and element; boundary parts carry conditions of condition_name for applying surface loads. Defaults: rectangle SmallDisplacementElement2D4N + LineLoadCondition2D2N,…

ParameterTypeDescription
divisions *array
kind *string
path *string
size *array
condition_name
element_name
trianglesboolean

mesh_remesh

Adaptively remesh a .mdpa with MMG (MeshingApplication) and write a new .mdpa; returns before/after mesh summaries, a boundary preservation check and the field transfer error. Needs KratosMeshingApplication built with MMG (see kratos_install). Strategies: 'levelset' refines around a signed distance given as 'region' ({"type": "sphere", "center": [x, y], "radius": r} or {"type": "box", "min": [...], "max": [...]}; "mode": "inside" (default, the whole region gets min_size) or "surface") or as 'distance_expression' in x, y, z; 'hessian' adap…

ParameterTypeDescription
input_mdpa *string
output_mdpa *string
applications
check_fields
distance_expression
field_expression
field_results
field_series
field_step
field_time
field_variable
freeze_sub_model_parts
interpolation_error
max_size
min_size
overwriteboolean
passesinteger
preserve_sub_model_parts
region
strategystring
timeoutnumber
transition_distance

mdpa_get_nodes

Return node ids and coordinates from a .mdpa file, optionally restricted to one submodelpart (dotted path like 'domain' or 'outer.inner') or an explicit id list. At most 'limit' nodes are returned (with a truncation flag).

ParameterTypeDescription
path *string
limitinteger
node_ids
sub_model_part

mdpa_get_entities

List elements, conditions or geometries of a .mdpa with their type, property id and node connectivity. kind: 'element' (default), 'condition' or 'geometry'. Filter by explicit ids, by entity_type (e.g. 'LineLoadCondition2D2N') and/or by sub_model_part (dotted path). At most 'limit' rows are returned, with the total count and a truncation flag.

ParameterTypeDescription
path *string
entity_type
ids
kindstring
limitinteger
sub_model_part

mdpa_select_nodes

Find nodes by geometry without changing anything. selector keys (combined as an intersection): ids, part (dotted SubModelPart), box {min:[x,y,z], max:[x,y,z]}, sphere {center, radius}, plane {point, normal} (nodes within 'tolerance' of the plane), expression (nodes where an expression in x, y, z is <= 0, e.g. 'x*x + y*y - 1.0' for a unit disc), tolerance (default 1e-9 x bounding-box diagonal), all=true. Returns the count, the first 'limit' ids and the bounding box of the selection. Pair with mdpa_create_sub_model_part to name the selectio…

ParameterTypeDescription
path *string
selector *object
limitinteger

mdpa_add_nodes

Add nodes ([x, y] or [x, y, z] each) to a .mdpa. Ids default to the next free ids; pass 'ids' to choose them. Optionally add them to an existing sub_model_part (dotted path). Edits in place unless 'output' is given.

ParameterTypeDescription
coordinates *array
path *string
ids
output
overwriteboolean
sub_model_part

mdpa_move_nodes

Move nodes: either set absolute 'coordinates' (one [x, y, z] per node, in the order of node_ids) or shift every chosen node by 'offset'. Choose the nodes with node_ids or a selector (see mdpa_select_nodes). Elements keep their connectivity, so check the result with mdpa_quality.

ParameterTypeDescription
path *string
coordinates
node_ids
offset
output
overwriteboolean
selector

mdpa_delete_nodes

Delete nodes (by id list or selector). Nodes still used by elements, conditions or geometries are refused unless cascade=true, which deletes those entities too. They are removed from every sub model part and from nodal data.

ParameterTypeDescription
path *string
cascadeboolean
node_ids
output
overwriteboolean
selector

mdpa_add_entities

Add elements, conditions or geometries of one type. kind: 'element', 'condition' or 'geometry'. entity_type is the Kratos name (e.g. 'SmallDisplacementElement2D4N', 'LineLoadCondition2D2N', 'Line2D2'); its 2D3N/3D8N-style suffix fixes the node count. Each item of 'entities' is {"nodes": [ids...], "id": optional, "property_id": optional (default 1, not for geometries)}. With sub_model_part the new entities and their nodes join that part (and its ancestors).

ParameterTypeDescription
entities *array
entity_type *string
kind *string
path *string
output
overwriteboolean
sub_model_part

mdpa_delete_entities

Delete elements, conditions or geometries by id (kind: 'element', 'condition', 'geometry'), or every one that belongs to sub_model_part. They are removed from all sub model parts; nodes are kept.

ParameterTypeDescription
kind *string
path *string
ids
output
overwriteboolean
sub_model_part

mdpa_set_entity_properties

Change the property id (which Materials.json entry applies) and/or the Kratos type name of elements or conditions (kind 'element'/'condition'; the new type must have the same node count). Choose entities by ids or by sub_model_part membership.

ParameterTypeDescription
kind *string
path *string
ids
new_type
output
overwriteboolean
property_id
sub_model_part

mdpa_create_sub_model_part

Create a sub model part (dotted name such as 'Structure_left' or 'domain.fixed' for a child; the parent must exist) from node ids or a selector (see mdpa_select_nodes) plus optional explicit element / condition / geometry ids. include lists entity kinds ('element', 'condition', 'geometry') whose members lying entirely on the part's nodes are added automatically -- use ['condition'] for a load surface. Nodes of added entities join too, and ancestors receive everything. exist_ok=true extends an existing part instead of failing.

ParameterTypeDescription
name *string
path *string
condition_ids
element_ids
exist_okboolean
geometry_ids
include
node_ids
output
overwriteboolean
selector

mdpa_edit_sub_model_part

Edit an existing sub model part (dotted path). action: 'add' members (nodes via node_ids/selector, elements, conditions, geometries; ancestors receive them too), 'remove' members (also from descendants), 'rename' (needs new_name, a single word) or 'delete' (the whole part, its children included; the entities themselves stay in the mesh).

ParameterTypeDescription
action *string
name *string
path *string
condition_ids
element_ids
geometry_ids
new_name
node_ids
output
overwriteboolean
selector

mdpa_transform

Transform node coordinates (all nodes unless node_ids/selector is given). operation: 'translate' (vector), 'rotate' (angle in degrees about axis, default z, through origin), 'scale' (factors: one number or per axis, about origin) or 'mirror' (across the plane through point with normal). Mirror and negative scaling re-order the connectivity (including quadratic mid-edge and face nodes) so cells keep a positive measure.

ParameterTypeDescription
operation *string
path *string
angle
axis
factors
node_ids
normal
origin
output
overwriteboolean
point
selector
vector

mdpa_merge

Append the mesh in 'other' to the one in 'path' and write 'output' (the inputs are untouched). Ids of 'other' are shifted past the first mesh's; sub model parts with the same name are united (their data, table and property references too). Tables, elemental/conditional data and all nodal data are carried over (colliding table ids are shifted). With merge_tolerance, coincident nodes (e.g. along a shared interface) are merged afterwards, so two blocks transformed into place become one conforming mesh. Inputs with blocks the editor cannot re…

ParameterTypeDescription
other *string
output *string
path *string
merge_tolerance
overwriteboolean

mdpa_renumber

Renumber nodes, elements, conditions and geometries consecutively from 'start' (references in sub model parts and nodal data follow). Useful after deleting entities or merging meshes.

ParameterTypeDescription
path *string
output
overwriteboolean
startinteger

mdpa_extract

Write the contents of one sub model part (dotted path) as a new .mdpa: its entities, the nodes they use, its children, and the part itself as the root part. The input is untouched.

ParameterTypeDescription
output *string
path *string
sub_model_part *string
overwriteboolean

mdpa_extrude

Extrude a planar (xy) mesh along z into a 3D mesh written to 'output'. heights are the layer thicknesses, e.g. [0.1] * 10 (z0 is the starting level). Triangles become prisms (3D6N), quads hexahedra (3D8N) and 2-node conditions surface quads (3D4N). Type names map '2DnN' -> '3DmN' unless overridden: element_names / condition_names map old -> new name (e.g. {"LineLoadCondition2D2N": "SurfaceLoadCondition3D4N"}). cap_condition_names maps the cap face node count ("3" or "4") to a condition type to create conditions on the new 'zmin' / 'zmax'…

ParameterTypeDescription
heights *array
output *string
path *string
cap_condition_names
condition_names
element_names
overwriteboolean
z0number

mdpa_convert_cells

Convert cell kinds. mode 'quad_to_tri' splits every quadrilateral element into 2 triangles (e.g. SmallDisplacementElement2D4N -> ...2D3N); 'hex_to_tet' splits hexahedra into 6 tetrahedra (Kuhn split, conforming for structured meshes with consistent node ordering) and the boundary quads into triangles matching the tet faces; 'quadratic_to_linear' drops the mid-edge/face nodes of quadratic cells (tri6->tri, quad8/9->quad, tet10->tet, hex20/27->hex, wedge15->prism, line3->line; ids and sub model parts unchanged, mid nodes kept as unused node…

ParameterTypeDescription
mode *string
path *string
condition_name
element_name
output
overwriteboolean

mdpa_extract_boundary

Create conditions on the free (unshared) faces of the elements -- the way to get load/flux surfaces on a mesh that has none -- and put them in sub_model_part (created if needed). condition_name is a Kratos type (e.g. 'LineLoadCondition2D2N', 'SurfaceLoadCondition3D4N') or a map {"2": ..., "3": ..., "4": ...} by face node count (needed for prisms, mixed meshes and quadratic cells: quadratic edges have 3 nodes, tet10 / wedge tri faces 6, hex20 / wedge quad faces 8, hex27 faces 9). element_part restricts to one part's elements; selector…

ParameterTypeDescription
condition_name *
path *string
sub_model_part *string
element_part
output
overwriteboolean
property_idinteger
selector

mdpa_set_properties

Edit the mesh-embedded 'Begin Properties' block of one property id (values {"DENSITY": 7850.0} are added/replaced, 'remove' deletes names; lists are written space separated) and/or the 'ModelPartData' header. Most cases keep material data in Materials.json instead -- see materials_set_property.

ParameterTypeDescription
path *string
model_part_data
output
overwriteboolean
property_id
remove
values

mdpa_set_nodal_data

Write a 'Begin NodalData <variable>' block value (an initial condition stored in the mesh, e.g. TEMPERATURE) on the chosen nodes (node_ids or selector). A float writes a scalar row, a string such as "[3](1.0, 0.0, 0.0)" a vector row (kept verbatim); fixed=true marks the rows fixed (constrained).

ParameterTypeDescription
path *string
value *
variable *string
fixedboolean
node_ids
output
overwriteboolean
selector

mdpa_get_data_blocks

List the data carried by a .mdpa besides the mesh itself: top-level Tables (id, variables, row count), 'Begin ElementalData' / 'Begin ConditionalData' variables with row counts, vector and flag 'Begin NodalData' blocks, and per-SubModelPart data/table/property references. All of these round-trip through every editing tool.

ParameterTypeDescription
path *string

mdpa_set_elemental_data

Upsert 'Begin ElementalData <variable>' (kind 'elemental') or 'Begin ConditionalData <variable>' (kind 'conditional') rows: values maps element/condition ids to numbers, lists (written space separated) or raw strings such as "[3](0.0, 1.0, 0.0)" for vectors (kept verbatim). remove_ids deletes rows. Ids must exist; rows follow renumber/merge/delete automatically.

ParameterTypeDescription
kind *string
path *string
variable *string
output
overwriteboolean
remove_ids
values

mdpa_set_table

Create or replace a top-level 'Begin Table <id> <x_variable> <y_variable>' block (piecewise-linear time series, e.g. TIME vs VELOCITY); rows are [x, y] pairs.

ParameterTypeDescription
path *string
rows *array
table_id *integer
x_variable *string
y_variable *string
output
overwriteboolean

mdpa_delete_table

Delete a top-level 'Begin Table' block. Refused while a SubModelPart references the table.

ParameterTypeDescription
path *string
table_id *integer
output
overwriteboolean

mdpa_set_sub_model_part_data

Replace a SubModelPart's data references wholesale (each None leaves that reference unchanged): data is the 'Begin SubModelPartData' key-value pairs, tables the 'Begin SubModelPartTables' table ids (must exist as top-level Tables), properties the 'Begin SubModelPartProperties' property ids.

ParameterTypeDescription
name *string
path *string
data
output
overwriteboolean
properties
tables

mdpa_quality

Mesh quality report, per element/condition type: count, measure (length/area/volume, from the corner nodes for quadratic cells) min/mean/max/total, aspect ratio (longest/shortest edge) with the ids of the worst cells, corner-angle extremes in degrees (angle_degrees: min, max and the ids with the smallest angle) for triangles and quads, and the ids of inverted or degenerate cells (non-positive signed measure -- these crash or poison a Kratos run). Linear, quadratic and cubic line, triangle, quad, tet, prism, pyramid and hex cells.

ParameterTypeDescription
path *string
worstinteger

mdpa_create_geometry_mesh

Generate a mesh of a parametric shape and write it as .mdpa (no gmsh needed). Every mesh gets a 'domain' part plus named boundary parts with conditions of condition_name (default LineLoadCondition2D2N in 2D, SurfaceLoadCondition3D4N in 3D). kind and its params: 'annulus' {r_inner, r_outer, n_radial, n_theta, angle=360, triangles=false} quads (or triangles); parts inner, outer (+ start, end for angle<360) 'disc' {radius, n_radial, n_theta} triangles; part boundary 'cylinder' {radius, height, n_radial, n_theta, n_z,…

ParameterTypeDescription
kind *string
params *object
path *string
condition_name
element_name
overwriteboolean

mesh_import

Convert a mesh file of another format (gmsh .msh, VTK .vtk/.vtu, MED, Abaqus .inp, Nastran, XDMF, ... anything meshio reads) into a Kratos .mdpa. The highest-dimension cells become elements, the next lower dimension conditions; named physical groups / cell sets become sub model parts (a 'domain' part with everything is added). Linear and quadratic line, triangle, quad, tetra, hexahedron, wedge and pyramid cells are converted, plus the cubic line4 / triangle10 / quad16 (other cubic and higher Lagrange cells are rejected). 15-node wedges an…

ParameterTypeDescription
output *string
source *string
condition_name
element_name
file_format
overwriteboolean
property_idinteger

mesh_export

Export a .mdpa to another mesh format chosen by the output extension (.vtk, .vtu, .msh, .med, .inp, .xdmf, ...) or file_format. Elements come first, then conditions; cell data carries kratos:id, kratos:property_id and kratos:entity (0 element / 1 condition), sub model parts become cell sets (format permitting) and scalar nodal data point data. Cubic triangle10 / quad16 / line4 cells only export to formats that have them (gmsh .msh, not VTK). meshio has no 15-node wedge or 13-node pyramid: they are refused unless linearize_unsupported=true…

ParameterTypeDescription
output *string
path *string
file_format
linearize_unsupportedboolean
overwriteboolean

mesh_generate_gmsh

Mesh arbitrary geometry with gmsh (optional extra: uv sync --extra gmsh) and write it as .mdpa. kind: 'polygon' -- vertices [[x, y], ...] (counter-clockwise) with optional holes (list of vertex loops); physical groups become sub model parts: domain, side_<i> (outer edge i), hole_<k>; quads=true recombines into quadrilaterals. 'shape' -- 3D tetrahedra of shape 'box' (shape_params {size_xyz: [lx, ly, lz], origin}), 'cylinder' ({radius, height}) or 'sphe…

ParameterTypeDescription
kind *string
output *string
cad_file
condition_name
diminteger
element_name
holes
overwriteboolean
property_idinteger
quadsboolean
shape
shape_params
size
size_min
timeoutnumber
vertices

project_get_setting

Read any part of a ProjectParameters.json by JSON Pointer, e.g. '/solver_settings/time_stepping/time_step' or '/processes/loads_process_list/0' ('' = the whole file or stage). For multi-stage (orchestrator) files pass stage; the pointer is then relative to that stage's stage_settings.

ParameterTypeDescription
parameters_file *string
pointerstring
stage

project_set_setting

Set (or add) any value in a ProjectParameters.json by JSON Pointer, e.g. pointer '/solver_settings/time_stepping/time_step' value 0.05, or '/processes/loads_process_list/-' to append a whole process block to a list. Missing intermediate objects are created when create=true. Returns the previous value. For multi-stage files pass stage (pointer relative to its stage_settings). The file is rewritten atomically.

ParameterTypeDescription
parameters_file *string
pointer *string
value *
createboolean
stage

project_delete_setting

Delete a key (or list item by index) from a ProjectParameters.json by JSON Pointer. Returns the removed value.

ParameterTypeDescription
parameters_file *string
pointer *string
stage

project_list_processes

List every process block of a ProjectParameters.json (all lists of 'processes' and 'output_processes') with its section, list name, index, python_module, model_part_name, variable_name and interval. The (list, index) pair addresses a block in project_update_process / project_remove_process.

ParameterTypeDescription
parameters_file *string
stage

project_add_process

Add ANY Kratos process to a ProjectParameters.json -- the generic counterpart of add_boundary_condition / add_output_process. python_module is a module name from kratos_list_processes (e.g. 'assign_scalar_variable_process', 'apply_constraint_vector_process', 'compute_...'); 'parameters' are its Parameters (see kratos_get_process_defaults for the schema). With merge_defaults (default) the process' real default settings fill every key you omit (needs the Kratos source tree). kratos_module is inferred ('KratosMultiphysics' for core,…

ParameterTypeDescription
parameters_file *string
python_module *string
kratos_module
merge_defaultsboolean
parameters
position
process_list
process_name
section
stage

project_update_process

Change the Parameters of one existing process block. Address it by process_list + index (from project_list_processes) or by matching python_module / model_part_name / variable_name (must match exactly one block). 'parameters' is deep-merged into the block's Parameters (nested objects merge, everything else replaces); replace=true swaps the whole Parameters object instead.

ParameterTypeDescription
parameters *object
parameters_file *string
index
model_part_name
process_list
python_module
replaceboolean
section
stage
variable_name

project_remove_process

Remove process blocks, addressed by process_list + index or by matching python_module / model_part_name / variable_name. More than one match is refused unless all_matches=true. Returns the removed blocks.

ParameterTypeDescription
parameters_file *string
all_matchesboolean
index
model_part_name
process_list
python_module
section
stage
variable_name

project_update_solver

Update solver_settings / problem_data of a ProjectParameters.json. 'settings' is deep-merged into solver_settings (e.g. {"solver_type": "Dynamic", "analysis_type": "non_linear", "residual_relative_tolerance": 1e-6}). linear_solver_preset applies a block from list_linear_solver_presets (sparse_lu, amgcl, cg, ...), or pass an explicit linear_solver_settings. time_step sets solver_settings.time_stepping.time_step; start_time / end_time live in problem_data. domain_size sets solver_settings.domain_size. mesh_file points model_import_s…

ParameterTypeDescription
parameters_file *string
domain_size
end_time
linear_solver_preset
linear_solver_settings
materials_file
mesh_file
settings
stage
start_time
time_step

materials_get

Read a Materials.json: one summary row per properties entry (model_part_name, properties_id, constitutive law, variable names) plus the raw document.

ParameterTypeDescription
materials_file *string

materials_set_property

Add or update ONE entry of a Materials.json (created if the file does not exist), keyed by model_part_name (e.g. 'Structure.domain'). New entries get the next free properties_id unless given. 'preset' (see list_material_presets) fills the constitutive law and default variables; 'constitutive_law' and 'variables' then override. On an existing entry, variables/tables are merged into the current ones; replace=true rebuilds the entry from scratch. This is the incremental counterpart of create_materials, which rewrites the whole file.

ParameterTypeDescription
materials_file *string
model_part_name *string
constitutive_law
preset
properties_id
replaceboolean
tables
variables

materials_remove_property

Remove entries from a Materials.json matching model_part_name and/or properties_id (all given criteria must match).

ParameterTypeDescription
materials_file *string
model_part_name
properties_id

materials_check

Cross-check a case's Materials.json against its mesh: every entry's model_part_name must be the root model part or one of the mesh's sub model parts, every properties_id used by an element needs an entry, and (with a Kratos build) every constitutive law must exist -- pass the application names that register them (e.g. ["StructuralMechanicsApplication"]) so they are imported first. Single-stage cases only.

ParameterTypeDescription
parameters_file *string
applications

run_simulation

Start a Kratos simulation as a background job and return its job_id. The analysis class is taken from the 'analysis_stage' key in the parameters, or inferred from solver_type; override with analysis_type (structural/fluid/thermal/potential_flow) or analysis_class ('module.path:ClassName'). If wait_seconds > 0, poll up to that long and return the final status if the job finishes in time. Track progress with job_status/job_logs. mpi_ranks launches the case under an MPI launcher (mpiexec/mpirun, or KRATOS_MPI_LAUNCHER) with that man…

ParameterTypeDescription
case_dir *string
analysis_class
analysis_type
external_inputs
isolateboolean
mpi_ranks
omp_threads
parameters_filestring
wait_secondsnumber

validate_case

Dry-run check of a case directory without running the time loop: JSON validity, required keys, mesh and materials files exist and parse, model part references match the mesh, and the solver settings validate against Kratos defaults.

ParameterTypeDescription
case_dir *string
parameters_filestring

job_status

Get the state of a simulation job (queued/running/succeeded/ failed/cancelled), elapsed time, and current step/time parsed from its log.

ParameterTypeDescription
job_id *string

job_list

List all known simulation jobs, optionally filtered by state (queued, running, succeeded, failed, cancelled).

ParameterTypeDescription
state

job_logs

Return the last 'tail' lines of a job's simulation log, optionally only lines containing the 'grep' substring (case-insensitive). For MPI jobs, 'rank' selects another rank's log (job_status lists rank_logs); rank 0 / unset is the main log.

ParameterTypeDescription
job_id *string
grep
rank
tailinteger

job_cancel

Cancel a running simulation job (SIGTERM, escalating to SIGKILL after a grace period). Signals the whole process group, so every MPI rank is stopped.

ParameterTypeDescription
job_id *string

job_rerun

Rerun a job from its preserved isolated input snapshot.

ParameterTypeDescription
job_id *string
wait_secondsnumber

configure_checkpoints

Configure serial single-stage checkpoint output before starting an isolated job.

ParameterTypeDescription
case_dir *string
frequency *number
control_typestring
max_files_to_keepinteger
parameters_filestring

job_checkpoints

List completed managed checkpoints, including retained/deleted availability.

ParameterTypeDescription
job_id *string

job_resume

Resume a terminal isolated job from an explicit job_checkpoints path into a new job.

ParameterTypeDescription
checkpoint *string
job_id *string
end_time
wait_secondsnumber

results_list

Discover result artifacts in a case directory (recursively): VTK/VTU files, GiD post files, HDF5, JSON results and point-output .dat/.csv files, sorted lexically by name (not physical time).

ParameterTypeDescription
case_dir *string

results_summary

Summarise a VTK/VTU result file: number of points/cells, the variables present, and per-variable statistics (min/max/mean, or magnitude stats for vector fields). Optionally restrict to one variable.

ParameterTypeDescription
file *string
variable

results_probe

Read the value of a variable at one location of a VTK/VTU result: either the mesh point nearest to 'point' [x, y, z], or the point at 0-based index 'node_index'. Returns the value and the actual coordinates used.

ParameterTypeDescription
file *string
variable *string
node_index
point

results_convergence

Extract convergence information from a simulation log (by job_id or explicit log file path): per-step nonlinear (or CoSimulation coupling) iteration counts, residual ratios, and which steps converged.

ParameterTypeDescription
job_id
log_file

results_time_history

Probe a physical-time series from an index path or explicit file/time records; optionally export CSV.

ParameterTypeDescription
source *
variable *string
associationstring
csv_file
entity_index
point
series

results_compare

Compare histories or matching-mesh fields at matching physical times without interpolation.

ParameterTypeDescription
candidate *
reference *
variable *string
associationstring
atolnumber
candidate_series
csv_file
entity_index
modestring
point
reference_series
rtolnumber
time_atolnumber

results_render

Render a VTK/VTU result file to a PNG screenshot, returned inline (requires the optional pyvista 'viz' extra). Colors the mesh by 'variable' (point or cell data; vector fields default to magnitude, or pick component 'x'/'y'/'z'), optionally warps the geometry by a vector field such as DISPLACEMENT scaled by warp_factor. Camera presets: xy, xz, yz, iso. crop_bounds clips to a region of interest before framing the camera -- [xmin,xmax,ymin,ymax] or [xmin,xmax,ymin,ymax,zmin,zmax] -- essential for e.g. a small body in a huge far-fiel…

ParameterTypeDescription
file *string
camerastring
component
crop_bounds
image_path
show_edgesboolean
variable
warp_by
warp_factornumber
window_size

results_animate

Render a time series of VTK/VTU results into an animated GIF (requires the optional pyvista 'viz' extra). 'files' is a directory (e.g. the case's vtk_output/) or a glob; frames are ordered by the numbers in their names. Coloring/warping/crop_bounds options as in results_render, with one color range, crop and camera across all frames. Small GIFs are returned inline; the file path is always returned.

ParameterTypeDescription
files *string
camerastring
component
crop_bounds
fpsinteger
gif_path
max_framesinteger
show_edgesboolean
variable
warp_by
warp_factornumber
window_size

explain_project_parameters

Parse an existing ProjectParameters.json and return a structured summary of what it configures: analysis type, solver + linear solver, mesh and material import, and the flattened boundary-condition / load / output process lists (with the model parts each targets). Multi-stage (orchestrator/stages) cases are summarized per stage. Use this to understand a case you did not scaffold before editing or running it.

ParameterTypeDescription
parameters_file *string

export_case_to_flowgraph

Convert a ProjectParameters.json into a Flowgraph (litegraph) graph.json that can be opened in the Kratos FlowGraph visual node editor. Returns the graph; when output_file is given it is also written there. Round-trips with import_flowgraph_to_case.

ParameterTypeDescription
parameters_file *string
output_file

import_flowgraph_to_case

Convert a Flowgraph (litegraph) graph.json -- as saved by the Kratos FlowGraph editor -- back into a ProjectParameters.json. Returns the parameters; when output_file is given it is also written there. Round-trips with export_case_to_flowgraph.

ParameterTypeDescription
graph_file *string
output_file

kratos_docs_structure

List the documentation topics DeepWiki has for a GitHub repository (default KratosMultiphysics/Kratos). Use it to find what to read before kratos_docs_read. Disabled unless the server runs with KRATOS_MCP_ENABLE_DEEPWIKI=1; sends the repo name to mcp.deepwiki.com.

ParameterTypeDescription
repostring

kratos_docs_read

Read the DeepWiki documentation of a GitHub repository (default KratosMultiphysics/Kratos). Output is truncated to about 20k characters (`truncated` says so); prefer kratos_docs_ask for a specific question. Disabled unless the server runs with KRATOS_MCP_ENABLE_DEEPWIKI=1.

ParameterTypeDescription
repostring

kratos_docs_ask

Ask DeepWiki a free-form question about Kratos (or another indexed repo): solver settings, process parameters, application behaviour, the meaning of an error. Answers may be stale or differ from the Kratos build installed here -- cross-check with kratos_list_* / kratos_get_process_defaults. The question text is sent to mcp.deepwiki.com; disabled unless KRATOS_MCP_ENABLE_DEEPWIKI=1.

ParameterTypeDescription
question *string
repostring

study_start

Prepare all isolated variants, then start a detached bounded study. specification: {kind:'parameter', axes:[{file:'Materials.json', pointer:'/properties/0/Material/Variables/YOUNG_MODULUS', values:[1e11,2e11]}], combination:'product'|'zip'} or {kind:'mesh', mesh:{kind:'rectangle', size:[1,0.2]}, divisions:[[4,1],[8,2],[16,4]]}. Optional atol/rtol/time_atol control mesh-response comparisons. Responses: [{name:'tip', variable:'DISPLACEMENT', point:[1,0,0], component:1, reduction:'final'}]. Optional response association: point/cell, series,…

ParameterTypeDescription
case_dir *string
responses *array
specification *object
analysis_class
analysis_type
external_inputs
max_concurrencyinteger
parameters_filestring

study_status

Return durable study progress, child jobs, provenance, and response errors.

ParameterTypeDescription
study_id *string

study_list

List studies, optionally filtering by their study-level state.

ParameterTypeDescription
state

study_cancel

Stop pending launches and cancel active process groups; preserve results.

ParameterTypeDescription
study_id *string

study_resume

Verify and resume an interrupted coordinator, adopting existing child jobs.

ParameterTypeDescription
study_id *string

study_results

Get partial/complete probe histories, scalar responses and mesh differences. Optional CSV uses exclusive creation and never overwrites an existing file.

ParameterTypeDescription
study_id *string
csv_file

session_start

Open an interactive Kratos session: load the case, build the AnalysisStage and run Initialize(), then return a session_id and the initial state (time 0, node/element counts, model parts). Nothing is solved until session_advance. Unlike run_simulation this keeps the live model in memory so you can step, inspect and modify it. Single-stage, serial/OpenMP cases only (multi-stage, CoSimulation, FSI and MPI cases are rejected: use run_simulation). isolate=True works on a private copy of the case so the original files and outputs stay untouche…

ParameterTypeDescription
case_dir *string
analysis_class
analysis_type
isolateboolean
parameters_filestring
timeoutnumber

session_list

List interactive sessions (newest first), optionally filtered by state: starting/ready/closed/dead/lost. 'lost' means the session belonged to a previous server process.

ParameterTypeDescription
state

session_status

State of a session: ready/closed/dead/lost, whether the worker is busy with a request, recorded step count, and (for dead sessions) why it died with the log tail. Set log_tail > 0 to include the last N lines of the session's solver log. Use session_model_info for the live simulation time/step.

ParameterTypeDescription
session_id *string
log_tailinteger

session_get_parameters

Read the live ProjectParameters of a session (after defaults were applied). path is an optional JSON Pointer such as '/solver_settings/time_stepping' or '/processes/loads_process_list/0'; empty returns everything.

ParameterTypeDescription
session_id *string
pathstring

session_advance

Advance the simulation by `steps` solution steps (or until the model time reaches `until_time`), running the same sequence as AnalysisStage.RunSolutionLoop: AdvanceInTime, InitializeSolutionStep, SolveSolutionStep, FinalizeSolutionStep and, if output=True, the configured output processes. Stops early at the case's end_time. Returns the new time, whether the run is finished, why it stopped (steps_completed / until_time_reached / end_time_reached) and a per-step history (step, time, converged, wall_seconds). If the call exceeds `ti…

ParameterTypeDescription
session_id *string
outputboolean
stepsinteger
timeoutnumber
until_time

session_model_info

Live model structure: node/element/condition counts for a model part (default: the solver's main model part) and its sub model parts down to `depth`, plus ProcessInfo TIME/STEP/DELTA_TIME/DOMAIN_SIZE and the buffer size. Use it to discover valid model_part names.

ParameterTypeDescription
session_id *string
depthinteger
model_part

session_field_summary

Summarise a field at the CURRENT time: min/max/mean (vectors by magnitude, with component-wise min/max), and the node/element where the maximum and minimum occur (with coordinates for nodes). location='nodes' reads nodal solution-step variables (DISPLACEMENT, REACTION, VELOCITY, PRESSURE, TEMPERATURE, ...). location='elements' evaluates an element result at the integration points and reports the worst Gauss point per element (e.g. VON_MISES_STRESS, TEMPERATURE gradients, CAUCHY_STRESS_VECTOR).

ParameterTypeDescription
session_id *string
variable *string
locationstring
model_part

session_inspect_node

Inspect one node: current and initial coordinates, the values of `variables` (default: DISPLACEMENT/REACTION/VELOCITY/PRESSURE/ TEMPERATURE as available) and whether each DOF is fixed.

ParameterTypeDescription
node_id *integer
session_id *string
model_part
variables

session_inspect_element

Inspect one element: its node ids, properties id, active flag, and the integration-point values of `variables` (e.g. ['VON_MISES_STRESS', 'GREEN_LAGRANGE_STRAIN_VECTOR']).

ParameterTypeDescription
element_id *integer
session_id *string
model_part
variables

session_set_nodal_values

Assign a nodal solution-step value (a number, or [x, y, z] for vector variables such as DISPLACEMENT or VELOCITY) to node_ids, or to every node of model_part when node_ids is omitted. fix=True/False fixes/frees the DOF (a list of 3 booleans sets each vector component); omit it to leave fixity unchanged. Takes effect from the next session_advance, so you can add a support, pin a temperature or perturb the state mid-run. Writes into the live model only: files on disk are unchanged.

ParameterTypeDescription
session_id *string
value *
variable *string
fix
model_part
node_ids

session_exec_python

Run Python inside the session's Kratos process for anything the typed tools do not cover. The namespace holds KM (KratosMultiphysics), model, stage (the AnalysisStage), session, parameters; assign a JSON-serialisable value to `result` to get it back, and print() output is returned as stdout. Example: result = model['Structure'].GetNode(75).X. DISABLED unless the MCP server was started with KRATOS_MCP_ALLOW_EXEC=1, because it executes arbitrary code as the server's user.

ParameterTypeDescription
code *string
session_id *string

session_close

Close a session. With finalize=True (default) the AnalysisStage's Finalize() runs first so output processes flush (VTK/GiD files, restart files); then the worker process group is terminated. Safe to call on an already closed or dead session.

ParameterTypeDescription
session_id *string
finalizeboolean