Groovy — 130 Operations for AI Agents

This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Groovy 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.

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-closure-parameter Add explicit closure parameter to replace implicit 'it'
add-groovydoc Add Groovy documentation comment
add-type-annotation Add explicit type annotation to variable or method
convert-each-to-for-loop Convert .each() closure back to for-in loop
convert-for-loop-to-collect Convert for loop collecting values to .collect() closure
convert-for-to-each Convert traditional for loop to .each() closure
convert-for-to-find Convert for loop with conditional break to .find()
convert-for-to-find-all Convert for loop collecting items to .findAll()
convert-from-gstring Convert GString interpolation back to string concatenation
convert-method-to-property Remove redundant getter method, relying on Groovy automatic property support
convert-static-import Add static import for frequently used methods
convert-string-to-gstring Convert string concatenation to GString interpolation
convert-to-closure Convert Java-style SAM interface to closure
convert-to-elvis Replace ternary with elvis operator
convert-to-groovy-bean Add @Canonical to make class a Groovy bean, consolidating transform annotations
convert-to-safe-navigation Add ?. operator for null-safe property access
encapsulate Make field private, generate getter/setter
extract-closure Extract closure expression
extract-constant Extract literal or expression into class-level constant
extract-constant Extract value to named constant
extract-function Extract selected code block into a new method
extract-interface Create interface from class
extract-variable Extract expression into a named local variable
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-accessors Generate Groovy getters/setters for fields
generate-builder Generate a fluent builder for a Groovy class
generate-canonical-constructor Generate @Canonical annotation
generate-constructor Generate a constructor from Groovy fields
generate-constructor-from-super Generate constructor that calls super()
generate-equals Generate an equals method from fields
generate-equals-and-hash-code Generate equals() and hashCode() method overrides
generate-from-json Generate JSON deserialization
generate-getters-setters-all Generate getters and setters for all class fields
generate-hash Generate a hashCode method from fields
generate-hash-code-method Generate hashCode() method override
generate-override-method Generate @Override method stub
generate-to-json Generate JSON serialization from fields
generate-to-string Generate a toString method from fields
import-add Add import statement for a symbol
import-organize Sort and organize import statements
import-remove Remove unused import statement
infer-variable-type Replace def with inferred type from initializer
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 Inline variable, function, or type alias
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-parameter Convert local variable to method parameter
invert-if-statement Invert if-else statement with condition negation
move Move symbol to new location, update imports
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-type-annotation Remove explicit type annotation, use def
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 variable, function, class, or field across all references
simplify-boolean-expression Simplify redundant boolean operations
wrap-null-check Wrap expression in null-check guard or safe navigation

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

← GraphQLHack →