Julia — 146 Operations for AI Agents
This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Julia code through the act MCP server. 146 operations available: 72 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.
Worked Julia examples
act101 edits Julia source using the expression and declaration structure the tree-sitter grammar exposes, so an edit targets a specific function, loop, or struct rather than a raw line offset. It can add a return type annotation to a function signature, making the function's contract explicit. It can expand a ternary expression into a multi-line if block. And it can rename a local variable at a given location, updating every reference to it within the same scope without touching a same-named variable in an enclosing or nested scope. Each example below is the verbatim output of the command shown, run against the file shown.
Add a return type annotation
add.jl declares add(x, y) with no return type, so the function's contract is implicit.
$ act refactor-lang add_return_type_annotation --file add.jl --params '{"return_type":"Int","line":1,"column":1}'
Before
function add(x, y)
x + y
end
After
function add(x, y)::Int
x + y
end
The signature becomes function add(x, y)::Int; the body's x + y is unchanged.
Expand a ternary into a multi-line if block
classify.jl squeezes a two-way branch into the single-line ternary x > 0 ? "positive" : "negative".
$ act refactor-lang convert_ternary_to_if --file classify.jl --params '{"line":1,"column":1}'
Before
result = x > 0 ? "positive" : "negative"
After
result = if x > 0
"positive"
else
"negative"
end
The ternary becomes a multi-line if x > 0 ... else ... end block; both branch results are unchanged.
Rename a local variable and its references
calculate.jl's calculate function assigns x = 5 and then returns x * 2.
$ act refactor-lang rename_local_variable --file calculate.jl --params '{"old_name":"x","new_name":"value","line":2,"column":5}'
Before
function calculate()
x = 5
return x * 2
end
After
function calculate()
value = 5
return value * 2
end
x becomes value in both the assignment and the return value * 2 expression that reads it.
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-assertion |
Add assertion statement |
add-broadcast-operator |
Add broadcast operator for vectorization |
add-const-qualifier |
Add const qualifier to variable |
add-default-argument |
Add default argument to function parameter |
add-docstring |
Add docstring to function/type |
add-method-extension |
Add new method to existing function via multiple dispatch |
add-return-type-annotation |
Add return type annotation to function |
add-type-annotation |
Add type annotation to variable/parameter |
add-type-restriction |
Add type restriction to method |
add-using-clause |
Add using statement for module |
convert-for-to-while |
Convert for loop to while loop |
convert-function-form |
Convert between function forms |
convert-if-to-ternary |
Convert if-else to ternary expression |
convert-import-to-using |
Convert import statement to using |
convert-loop-to-array-comprehension |
Convert loop to array comprehension |
convert-mutable-to-struct |
Convert mutable struct to struct |
convert-string-concat-to-interpolation |
Convert string concatenation to string interpolation |
convert-string-interpolation |
Convert to string interpolation |
convert-struct-to-mutable |
Convert struct to mutable struct |
convert-ternary-to-if |
Convert ternary expression to if-else |
convert-to-anonymous-function |
Convert named function to anonymous |
convert-to-multiple-dispatch |
Insert a typed multiple-dispatch overload for a function |
convert-to-named-function |
Convert anonymous function to named |
convert-to-vectorized-form |
Convert to vectorized form |
convert-using-to-import |
Convert using statement to import |
convert-while-to-for |
Convert while loop to for loop |
encapsulate |
Make field private, generate getter/setter |
extract-block-to-function |
Extract code block to function |
extract-constant |
Extract literal to named constant |
extract-function |
Extract code range to new function |
extract-type-alias |
Extract type expression to alias |
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)] |
generate-abstract-method |
Generate abstract method signature |
generate-accessors |
Generate getters/setters for fields |
generate-builder |
Generate builder pattern |
generate-constructor |
Generate an inner constructor for a struct |
generate-doctest |
Generate doctest examples |
generate-equality-operator |
Generate equality comparison operator |
generate-equals |
Generate equals/eq comparison method |
generate-from-json |
Generate JSON deserialization |
generate-getindex-setindex |
Generate getindex and setindex! methods for array-like interface |
generate-getter-setter |
Generate getter/setter methods |
generate-hash |
Generate hash/hashCode method |
generate-string-representation |
Generate string representation method |
generate-struct-constructor |
Generate struct constructor |
generate-test-scaffold |
Generate test scaffold for function |
generate-to-json |
Generate JSON serialization |
generate-to-string |
Generate string representation |
generate-type-constructor |
Generate type constructor |
generate-type-conversions |
Generate Base.convert method for type conversion |
generate-type-method |
Generate type method |
import-add |
Add a using/import statement |
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 function call |
inline-local-variable |
Inline local variable |
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-local-variable |
Introduce local variable |
invert-if-condition |
Invert if condition logic |
merge-nested-ifs |
Merge nested if statements |
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)] |
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-const-qualifier |
Remove const qualifier |
remove-type-restriction |
Remove type restriction |
remove-unused-parameter |
Remove unused function parameter |
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-local-variable |
Rename local variable |
replace-ternary-with-if |
Replace ternary with if statement |
simplify-expression |
Simplify expression |
split-conditional |
Split conditional into separate statements |
swap-function-arguments |
Swap function parameter order |
wrap-in-try-catch |
Wrap code in try-catch block |
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