Erlang — 165 Operations for AI Agents
This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Erlang code through the act MCP server. 165 operations available: 91 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.
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-function-spec |
Add -spec directive for function |
add-guard |
Add guard condition to function clause |
add-import |
Add -import directive for external function |
add-module-directive |
Add module directive (-module, -export, or -define) |
add-record-field |
Add new field to record definition |
add-to-export-list |
Add function to -export list |
combine-clauses |
Combine multiple clauses |
comment-out-function |
Comment out a function definition |
convert-anonymous-to-named-function |
Convert anonymous fun to named function |
convert-atom-to-string |
Convert atom to string literal |
convert-case-to-function-clauses |
Convert case expression to multi-clause function |
convert-guards-to-if |
Convert function clause guards to if-expression |
convert-if-to-guards |
Convert if-expression to function clause guards |
convert-list-concat-to-comprehension |
Convert list:concat/lists:flatten to list comprehension |
convert-list-filter-to-comprehension |
Convert lists:filter to list comprehension |
convert-list-map-to-comprehension |
Convert lists:map to list comprehension |
convert-record-to-tuple |
Convert record pattern to tuple pattern |
convert-recursion-to-loop |
Convert tail-recursive function to iterative loop using lists:foldl |
convert-string-concat-to-operator |
Convert string:concat to ++ operator |
convert-string-to-atom |
Convert string to atom literal |
convert-to-anonymous-function |
Convert named function to anonymous fun |
convert-to-string-interpolation |
Convert string concatenation to a single string |
convert-tuple-to-record |
Convert tuple pattern to record pattern |
delete-unused-variable |
Remove unused variable bindings |
extract-clause |
Extract function clause into separate function |
extract-constant |
Extract a literal value to a named constant |
extract-function |
Extract code into a new function |
extract-macro |
Extract repeated code pattern to -define macro |
extract-variable |
Extract expression into a named variable binding |
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)] |
flatten-nested-call |
Flatten nested calls |
generate-base-case |
Generate base case for recursive function |
generate-binary-pattern |
Generate binary pattern for matching |
generate-callback-implementation |
Generate callback function for behavior |
generate-error-tuple |
Generate {error, Reason} return pattern |
generate-exception-handler |
Generate catch clause for exception type |
generate-export-list |
Generate -export list from functions |
generate-function-clauses |
Generate function clauses for pattern cases |
generate-function-documentation |
Generate documentation comment block |
generate-function-from-spec |
Generate function stub from -spec declaration |
generate-function-spec |
Generate -spec directive from implementation |
generate-guard-pattern |
Generate guard clause template |
generate-list-comprehension |
Generate list comprehension from loop |
generate-module-documentation |
Generate -doc comment for the module |
generate-module-structure |
Generate module skeleton |
generate-pattern-match-clauses |
Generate clauses for exhaustive pattern matching |
generate-recursive-case |
Generate recursive case template |
generate-test-module |
Generate test module skeleton |
generate-try-catch |
Generate try-catch template |
generate-type-definition |
Generate custom -type definition |
generate-unit-test |
Generate unit test case for function |
infer-function-spec |
Infer and suggest -spec directive |
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 at all use sites |
inline-import |
Inline -import directive, replacing calls with fully qualified module:function() calls |
inline-macro |
Inline -define macro at all usage sites |
inline-variable |
Inline variable references at all use sites |
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-clause |
Introduce a new clause to handle a pattern case |
invert-conditional |
Invert conditional expression by swapping branches and negating condition |
invert-pattern-match |
Invert guard logic |
join-strings |
Join multiple string concatenations |
merge-clauses |
Merge multiple function clauses into one with guards |
move-function |
Move function to another module with import updates |
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 and deduplicate -import directives |
pull-up-function |
Move function to parent module or shared location |
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-all-comments |
Remove all comments from module |
remove-comment |
Remove single comment line |
remove-dead-code |
Remove unreachable code and unused bindings |
remove-from-export-list |
Remove function from -export list |
remove-function-spec |
Remove -spec directive |
remove-guard |
Remove guard from function clause |
remove-import |
Remove -import directive if unused |
remove-record-field |
Remove field from record definition |
remove-unnecessary-nesting |
Remove unnecessary nesting in case/if expressions |
remove-unused-binding |
Remove variable never 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 |
Rename symbol and all references |
rename-import |
Rename a module reference in import statements |
rename-record-field |
Rename field in record definition |
simplify-boolean-expression |
Simplify boolean logic |
simplify-conditional |
Simplify conditional expression by removing redundancy |
simplify-guard |
Simplify guard expression |
split-clause |
Split clause into patterns |
split-string-literal |
Split long string into multiple lines |
swap-match-branches |
Swap then/else branches in case/if expression |
uncomment-code |
Uncomment commented-out code |
uncomment-function |
Uncomment a function definition |
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