Ruby — 207 Operations for AI Agents

This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Ruby code through the act MCP server. 207 operations available: 133 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
133Refactor
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-attr-accessor Create explicit attr_accessor from getter+setter
add-attr-class-variable Add @@var class variable
add-attr-reader Create explicit attr_reader from getter method
add-attr-writer Create explicit attr_writer from setter method
add-ensure-clause Add ensure block for cleanup
add-namespace Wrap code in module Namespace; end
add-raise-statement Add explicit raise for error condition
add-self-parameter Explicit self in class method definition
add-type-comment Add @type [Type] comment for static analysis
change-signature Modify function parameters, return, generics
change-visibility Change method access level (private/protected/public)
convert-block-to-lambda Convert block to lambda declaration
convert-block-to-proc Convert block to &:method_name syntax
convert-braces-to-do-end Convert { } block to do...end
convert-case-to-if Convert case statement to if/elsif
convert-class-to-module Convert class to module (if no constructor)
convert-do-end-to-braces Convert do...end block to { }
convert-double-to-single-quotes Double quote to single quote literals
convert-each-to-for Convert .each to for loop
convert-exception-to-specific-type Make rescue catch specific exception type
convert-for-to-each Convert for loop to .each iteration
convert-for-to-while Convert for loop to while
convert-heredoc-to-string Convert heredoc back to string literal
convert-if-else Convert between if-else patterns
convert-if-to-case Convert multiple elsif to case
convert-if-to-unless Convert if !x to unless x
convert-lambda-to-block Convert lambda to block when passed to method
convert-loop-to-break Convert loop to conditional iteration
convert-method-body-to-one-liner Collapse multi-line method to single line
convert-method-to-property Convert accessor method to attr_accessor
convert-modifier-if Convert if modifier to block form
convert-module-to-class Convert module to class
convert-one-liner-to-method-body Expand one-liner to multi-line
convert-percent-literal-to-string Convert %w() word array to string literal
convert-proc-to-block Convert proc parameter to explicit block
convert-property-to-method Convert attr_accessor to explicit getter/setter
convert-require-relative-to-require Convert require_relative to require
convert-require-to-require-relative Convert require to require_relative
convert-rescue-to-rescue-in-method Extract rescue to method-level
convert-single-to-double-quotes Single quote to double quote literals
convert-singleton-to-class-method Convert singleton method to class method definition
convert-string-to-symbol Convert string to symbol for hash keys
convert-symbol-to-string Convert symbol to string literal
convert-ternary Convert ternary expressions and conditionals
convert-to-guard-clause Extract common condition to guard at method start
convert-to-heredoc Convert string to heredoc for multiline
convert-to-rbs-signature Convert method to RBS type signature format
convert-to-safe-navigation Convert if check to safe navigation operator (&.)
convert-to-string-interpolation Convert string concatenation to interpolation
convert-unless-to-if Convert unless x to if !x
convert-while-to-for Convert while loop to for
copy-method Duplicate method declaration
delete Delete unused symbol
extract-block-parameter Name unnamed block parameters
extract-class Extract methods/fields to new class
extract-constant Extract value to named constant
extract-method Extract code into a new method
extract-variable Extract expression to 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 attr_reader, attr_writer, attr_accessor
generate-class Generate new class skeleton
generate-class-methods-block Generate class << self section
generate-clone Generate clone (deep copy)
generate-comparable-implementation Generate <=> for sorting
generate-constructor Generate initialize method from class variables
generate-custom-exception Generate custom exception class
generate-debug-print Add debug output statement
generate-define-method Generate define_method for dynamic methods
generate-dup Generate dup (shallow copy)
generate-enum-like-class Generate class with enum-like constants
generate-enumerable-delegation Generate include Enumerable with iteration
generate-equals Generate ==, !=, eql? implementations
generate-example-usage Generate usage examples in comments
generate-fixture-method Generate test fixture setup
generate-getter-method Generate a getter method for an instance variable
generate-guard-statements Generate nil/type guards at method start
generate-hash Generate hash for use in collections
generate-initialize-from-attributes Generate initialize accepting attribute hashes
generate-inspect Generate inspect method
generate-keyword-initialize Generate keyword argument initialize(**kwargs)
generate-method-missing Generate method_missing handler
generate-method-signature-doc Generate method signature documentation
generate-mixin Generate module for inclusion as mixin
generate-mock-object Generate mock/stub object for testing
generate-module Generate module with namespace
generate-precondition-checks Generate argument validation
generate-rdoc-comment Generate RDoc documentation skeleton
generate-respond-to-missing Generate respond_to_missing?
generate-setter-method Generate a setter method for an instance variable
generate-singleton-class Generate singleton methods for object
generate-subclass Generate subclass extending parent
generate-tests Generate test method skeleton
generate-to-h Generate to_h for hash conversion
generate-to-string Generate to_s string representation
generate-todo-comment Generate TODO/FIXME placeholder
generate-validation-method Generate method for parameter validation
generate-with-index-iteration Generate each_with_index method
import-add Add require statement
import-organize Organize and sort requires
import-remove Remove unused require 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-method Inline method body at call sites
inline-variable Inline variable at all references
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-variable Extract expression to local variable
invert-if-else Swap if and else branches, negate condition
join-string-literals Concatenate adjacent string literals
make-method-instance Convert class method to instance method
make-method-static Convert instance method to class method
merge-nested-if Merge nested if conditions into compound condition
merge-rescue-clauses Combine multiple rescue handlers
move Move method to another class/module
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-attr-class-variable Convert class variable to instance variable
remove-empty-else Remove empty else clause
remove-empty-rescue Remove rescue clause that does nothing
remove-redundant-require Remove duplicate or unnecessary require
remove-safe-navigation Convert &.method to .method when safe
remove-self-parameter Remove explicit self when not needed
remove-type-comment Remove type comment annotation
remove-unnecessary-block Remove block when method doesn't use it
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
simplify-boolean-assignment Simplify x = x || y to x ||= y
sort-method-declarations Sort methods by visibility (private/public)
split-if-condition Split compound if into nested if
split-string-literal Split long string into multiple parts
swap-statements Reorder two adjacent statements
wrap-in-begin-rescue Wrap statement in exception handler
wrap-null-check Wrap expression in nil check guard
wrap-try-catch Wrap code in begin...rescue...end 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

← Robot FrameworkRust →