Skip to content

Simulation & jobs

Simulations run as detached background jobs — the server stays responsive, a solver crash cannot take it down, and jobs survive server restarts. State lives in ~/.kratos-mcp/jobs/<job_id>/.

run_simulation

needs Kratos

Start a simulation job.

ParameterTypeDescription
case_dirstringdirectory containing the case
parameters_filestringdefault ProjectParameters.json
analysis_typestring?structural / fluid / thermal / potential_flow override
analysis_classstring?fully qualified module.path:ClassName override
wait_secondsnumberpoll up to this long and return the final status if the job finishes in time (default 0 = return immediately)

The analysis class is normally resolved from the analysis_stage key that our templates write into ProjectParameters.json, falling back to inference from solver_type.

Returns: the job status (below). For quick cases pass wait_seconds: 60120 and get the terminal state in one call; failed jobs include a log_tail.

json
{ "job_id": "20260712-101530-a1b2c3", "state": "succeeded", "returncode": 0, "elapsed_seconds": 2.0 }

validate_case

needs Kratos for the deep part

Dry-run check of a case directory — everything validate_project_parameters does, run from the case root. Call it before run_simulation; it catches the common failure modes in seconds instead of after a failed run.

job_status

ParameterType
job_idstring

Returns: state (queued / running / succeeded / failed / cancelled), returncode, elapsed_seconds, and progress parsed from the log: current_step, current_time, num_steps_seen, errors_detected.

job_list

List all known jobs, optionally filtered by state.

job_logs

ParameterTypeDescription
job_idstring
tailintlast N lines (default 100)
grepstring?case-insensitive substring filter

The complete live log is also available as the resource kratos://jobs/{job_id}/log.

job_cancel

Cancel a running job: SIGTERM to the job's process group, escalating to SIGKILL after a 5 s grace period. Cancelling a finished job is a no-op and returns its final state.