Modelica — 130 Operations for AI Agents

Modelica models physical systems — thermal, mechanical, electrical — as equations engineers simulate before they build. act101 navigates models, connectors, and parameters structurally, so agents work in simulation code with engineering precision.

This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Modelica code through the act MCP server. 130 operations available: 56 refactor, 18 query, 42 analysis, 14 verification. Each operation is callable from Claude Code, Cursor, Codex, OpenCode, or any MCP-compatible agent host. Click any operation for a stable anchor link suitable for citation.

Premium language. Operations on Modelica require an Elite license or above. See pricing.

18Query
56Refactor
42Analysis
14Verify

Query

18 query tools, the same on every supported language. Descriptions live in the shared reference: /docs/query-tools.

callers control_flow data_flow definition diagnostics effect_closure effect_summary fix_auto get_type graph import_organize interface mutations references repo_outline skeleton symbols symbols_batch

Refactor

Operation Description
add-connection Insert a `connect(a, b);` equation into a named Modelica class's equation section. Rejects if the class or equation section is missing, an endpoint is not a valid component reference, or an identical connect is already present.
add-extends Insert an `extends <BaseClass>;` clause as the first element of a named Modelica class body. Rejects if the class is missing or already extends the base.
add-flow-variable Add a variable declaration to a Modelica connector class (`flow <type> <name>;` when flow is true, else `<type> <name>;`). Rejects if the target is not a connector, the connector is missing, or the name is invalid.
add-parameter Insert a parameter declaration into a named Modelica class among its existing declarations.
convert-equation-to-algorithm Move one simple equation `lhs = rhs;` out of the equation section into the class's algorithm section as `lhs := rhs;`. Creates an `algorithm` section if none exists. Rejects if the equation is not simple or lives in an `initial equation` section.
convert-model-to-block Convert a `model` class to a `block` by replacing the `model` keyword token in its ClassPrefixes with `block` via the AST keyword-token byte range. Does NOT reclassify connector inputs/outputs (ambiguous, out of scope). Rejects if the class is missing, not a model, or already a block.
convert-to-expandable-connector Convert a Modelica connector class to `expandable connector` by inserting the `expandable` keyword into its ClassPrefixes. Rejects if the target is not a connector, the connector is missing, or it is already expandable.
convert-to-replaceable Prefix a named Modelica component declaration with `replaceable`. Rejects if the component is missing or already replaceable.
extract-base-class Move a named Modelica class's component declarations into a new partial model block inserted before it, and rewrite the source class body to `extends <Base>;` (preserving its equation section). Rejects if the class is missing or has no component declarations.
extract-connector Group two related scalar variable declarations in a class into a new connector block inserted before the source class, and replace the two declarations with a single instantiation.
extract-function Extract a single algorithm-section assignment statement (`target := <rhs>;`) into a new top-level function with one output and replace the statement with a call. Equation-section sources (`target = <rhs>;`) are rejected.
extract-model Extract a component declaration and the equations referencing it into a new model block inserted before the source class, and replace the component with an instantiation.
extract-parameter Extract a numeric literal in an equation/algorithm into a named parameter declaration and replace the literal with a reference.
extract-record Group two or more named variable/parameter declarations in a class into a new record block inserted before the source class, and replace those declarations with a single instantiation.
extract_function Extract a code selection into a new function — automatically infers parameters, return types, and inserts the call site. Use instead of manually cutting/pasting code. Works without LSP; LSP improves type inference. Params: file (string), new_name (string), start_line (u32), start_column (u32), end_line (u32), end_column (u32) [, preview (bool), receipt (bool)]
extract_variable Extract an expression into a named variable — inserts the declaration and replaces the expression with the variable name. Works without LSP. Params: file (string), new_name (string), start_line (u32), start_column (u32), end_line (u32), end_column (u32) [, preview (bool)]
fix-missing-parameter-value Add a default/start value to a Modelica `parameter` declaration that has none by inserting ` = <value>` before the declaration's trailing `;` at the AST byte offset. Rejects if the parameter is missing, is not a `parameter`, or already has a value.
fix-missing-units Add a `unit` attribute to a Modelica component declaration lacking one: inserts `(unit="<unit>")` after the variable name when no modification exists, or appends `, unit="<unit>"` before the closing `)` of an existing modification list. Does not validate the unit string. Rejects if the variable is missing or already has a unit attribute.
fix-type-mismatch Change a component's declared type by replacing the TypeSpecifier node text (e.g. `Real x;` -> `Integer x;`). This is a textual type swap, NOT semantic type inference: it does not check assignment compatibility. Rejects if the variable is missing.
fix-unbalanced-connector Balance a Modelica connector that has one variable kind but not the other. Provide `flow_name` to add a `flow Real <name>;` when the connector has a potential but no flow variable, or `potential_name` to add a `Real <name>;` when it has only a flow variable. Exactly one of the two names must be given. Rejects if the target is not a connector, already balanced, or already has the requested kind.
fix-unconnected-connector Add a `connect(<connector>, <target>);` equation to a class's equation section for an unconnected connector component, mirroring add_connection. Rejects if the class, connector component, or equation section is missing, or the connector is already referenced by an existing connect equation.
fix-unused-component Annotate a proven-unused Modelica component with a leading `// unused: <reason>` comment line before its declaration (preserves the declaration, unlike remove_unused_component). Defaults the reason to `unreferenced` when omitted. Rejects if the component is missing or actually referenced in equations/connect clauses.
gen-block Append a causal `block <name>` scaffold at EOF with `input Real <i>;` per input, `output Real <o>;` per output, and an equation section with a stub assignment. Parse-valid even with empty inputs/outputs. Rejects an invalid name.
gen-connector Append a balanced `connector <name>` scaffold at EOF with one potential (`Real <potential_name>;`) and one flow variable (`flow Real <flow_name>;`). Defaults potential_name to `v` and flow_name to `i`. Rejects an invalid name.
gen-documentation-template Append a `model <name>` class carrying `annotation(Documentation(info=...))`. The annotation is wrapped in a model class because a bare top-level annotation is not valid Modelica. Defaults info to `<html></html>`. Rejects an invalid name.
gen-function Append a `function <name>` scaffold at EOF with `input Real <i>;` per input, `output Real <o>;` per output, and a minimal algorithm section with one stub assignment. Parse-valid even with empty inputs/outputs. Rejects an invalid name.
gen-icon-annotation Append a `model <name>` class carrying a minimal stub `annotation(Icon(coordinateSystem(extent=...)))` (default extent only, no graphics primitives). The annotation is wrapped in a model class because a bare top-level annotation is not valid Modelica. Rejects an invalid name.
gen-model-scaffold Append a minimal `model <name>` scaffold at EOF with one `parameter Real <p>;` per parameter, one `Real <c>;` per component, and a single equation section with a stub equation. Parse-valid even with empty parameters/components. Rejects an invalid name.
gen-package Append a `package <name>` scaffold at EOF with one stub class per entry (each stub is `model <c>` with an empty body). Parse-valid even with an empty classes list. Rejects an invalid name.
gen-partial-base Append a `partial model <name>` inheritance-template base at EOF with one `parameter Real <p>;` per parameter. Parse-valid even with an empty parameters list. Rejects an invalid name.
gen-record Append a `record <name>` scaffold at EOF with `Real <field>;` per field. Parse-valid even with an empty fields list. Rejects an invalid name or field name.
gen-test-model Append a `model <name>` test harness that instantiates a unit-under-test (`<uut> u;`) and carries `annotation(experiment(StartTime=0, StopTime=<stop_time>))`. Defaults stop_time to 1.0. Rejects an invalid name.
inline Inline a variable, function, or method — replace every usage with its definition body, then remove the original. The inverse of extract. Works without LSP (single-file); LSP enables cross-file inlining. Params: file (string), symbol (string) [, line (u32), preview (bool), receipt (bool)]
inline-function Inline a simple single-input single-output single-statement Modelica function at its single call site, substituting the argument into the body, and delete the function definition.
inline-model Flatten a component's instantiated model into the enclosing class: move the sub-model's component declarations and equations into the parent (qualifying internal references by the instance name), remove the instantiation, and delete the sub-model. Rejects if the sub-model has parameters/inputs/outputs, nested classes, or references outside its own components.
insert_body Replace a function's implementation body with new code. AST-validated — rejects if the result has parse errors, so you can't accidentally break syntax. Use instead of manual text editing for function rewrites. Params: file (string), symbol (string), code (string) [, commit (bool)]
introduce-initial-equation Move one simple equation into an `initial equation` section. Creates `initial equation` before the regular equation section if none exists. Rejects if the equation is not simple or already lives in an initial section.
make-partial Insert the `partial` keyword into a named Modelica class's ClassPrefixes (before the class-kind keyword). Rejects if the class is missing or already partial.
move-to-package Wrap a file's top-level classes in a new `package <name> ... end <name>;`, re-indenting the wrapped lines by two spaces. Rejects if the file has no top-level classes or already contains a top-level package (refuses to double-wrap).
move_symbol Move a function, class, or type to a different file and automatically update all imports across the codebase. Use instead of manually cut/paste + fixing imports. Works without LSP (single-file); LSP enables cross-file import updates. Params: file (string), symbol (string), destination (string) [, preview (bool), receipt (bool)]
organize-imports Sort, deduplicate, and reorder Modelica import clauses within a file's contiguous import region.
promote-parameter Lift a sub-component's parameter modification to the parent class: adds `parameter <T> <param> = <value>;` to the parent (type derived from the sub-type's parameter declaration) and removes the `<param>=<value>` from the sub-component's modification (removing the whole `(...)` when it was the only key). Rejects if the sub-component lacks the modification or the sub-type lacks the parameter.
recipe_run Run a codemod recipe: declarative match → transform → optional verify across modeled grammars. Preview lists matches; apply writes with optional E7 receipts and all-or-nothing rollback. Returns a per-site report.
remove-connection Remove a `connect(a, b);` equation matching the given endpoints from a named Modelica class. Rejects if the class or the matching connect equation is missing.
remove-extends Remove an `extends <BaseClass>;` clause from a Modelica class by base name, deleting the whole physical line. Rejects if the class or extends clause is missing.
remove-parameter Remove a parameter declaration by name from a Modelica class. Rejects if the parameter is still referenced.
remove-unused-component Remove a component declaration that is never referenced in equations or connect() clauses within its Modelica class. Rejects if the component is referenced.
rename Rename a symbol and automatically update ALL references across the codebase. Safer and faster than find-and-replace — AST-aware, won't rename strings or comments. Works without LSP (single-file); LSP enables cross-file renames. Params: file (string), old_name (string), new_name (string) [, line (u32), column (u32), preview (bool), receipt (bool)]
rename-class Rename a Modelica class and same-file references.
rename-component Rename a Modelica component instance and same-class modifications, equation, and connect() references.
rename-connector Rename a Modelica connector class and file-wide component declarations and connect() references.
rename-function Rename a Modelica function class and file-wide call sites.
rename-parameter Rename a Modelica parameter declaration and same-class modifications and references.
rename-variable Rename a Modelica variable in the correct class scope and update equation/algorithm references.
set-modification Set or replace a named modification value on a component declaration in a named class. Replaces the existing value when the key is present, appends `, key=value` when a modification list exists but lacks the key, or inserts `(key=value)` after the component name when no modification exists. Rejects if the class, component, key, or value is missing.
vectorize-equation Collapse exactly two consecutive scalar array-indexed equations (e.g. `x[1] = a[1];` then `x[2] = a[2];`) into one `for i in 1:2 loop ... end for;`. Rejects if there are not exactly two consecutive equations, the indices are not consecutive integers starting at 1, or the equations differ in structure beyond the index.

Analysis

42 analysis tools, the same on every supported language. Descriptions live in the shared reference: /docs/analysis-tools.

analyze_api_diff analyze_chokepoints analyze_clones analyze_clusters analyze_cohesion analyze_conformance analyze_coupling analyze_cycle_risk analyze_cycles analyze_dead_code analyze_depth analyze_entry_points analyze_export analyze_extraction analyze_fan_balance analyze_features analyze_hotspots analyze_impact analyze_inconsistencies analyze_inheritance analyze_interface_bloat analyze_interfaces analyze_layers analyze_orphan_types analyze_patterns analyze_platform_deps analyze_readiness analyze_roles analyze_seams analyze_stability analyze_surface analyze_test_gaps analyze_thickness analyze_type_completeness churn_hotspots co_change_clusters coverage_overlay ownership_map profile_overlay simulate split_module trace_overlay

Verify

14 verify tools, the same on every supported language. Descriptions live in the shared reference: /docs/verification.

bisect_regression gate generate_test_harness scan secret_surface summarize_pr taint_flow unsafe_surface verify_behavioral_equivalence verify_contract_preserved verify_diff_semantics verify_port_parity verify_side_effects verify_test_impact

← MLIRMove →