C# — 174 Operations for AI Agents
This page is the canonical reference an AI coding agent uses to refactor, query, and analyze C# code through the act MCP server. 174 operations available: 100 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-braces |
Add braces to code blocks |
add-braces-to-if-else |
Add braces to if/else statements |
add-braces-to-switch-section |
Add braces to switch case sections |
add-missing-cases-to-switch |
Add missing enum cases to switch statement |
add-missing-import |
Add missing using statement |
add-null-guard |
Add null check guard clause |
add_argument_name |
Add named argument label to a method call argument |
add_default_value_to_parameter |
Add a default value to a method parameter |
add_using_directive |
Add a using directive for a namespace |
add_using_static_directive |
Add a using static directive for a type |
change-signature |
Modify function parameters, return, generics |
change-type |
Change variable type annotation |
change-visibility |
Change access modifier (public/private/protected/internal) |
change_type_according_to_expression |
Update declared type to match the actual expression type |
check_expression_for_null |
Wrap expression with a null check |
check_parameter_for_null |
Add null check for a method parameter |
consolidate-import-statements |
Consolidate multiple import statements |
convert-auto-property-to-full-property |
Convert auto property to full property with backing field |
convert-block-body-to-expression-body |
Convert block body to expression body |
convert-lambda-block-body-to-expression-body |
Convert lambda block body to expression body |
convert-string-format-to-interpolation |
Convert string.Format to string interpolation |
convert-switch-to-expression |
Convert switch statement to switch expression |
convert-to-record |
Convert class to record type |
convert_do_to_while |
Convert do-while loop to while loop |
convert_expression_body_to_block_body |
Convert expression-bodied member to block body |
convert_for_to_foreach |
Convert index-based for loop to foreach |
convert_for_to_while |
Convert for loop to while loop |
convert_foreach_to_for |
Convert foreach loop to index-based for loop |
convert_if_to_switch |
Convert if/else chain to switch statement |
convert_lambda_expression_body_to_block_body |
Convert lambda expression body to block body |
convert_switch_to_if |
Convert switch statement to if/else chain |
convert_ternary_to_if_else |
Convert ternary operator to if/else statement |
encapsulate |
Make field private, generate getter/setter |
expand-coalesce-expression |
Expand coalesce operator to null check |
expand-compound-assignment |
Expand compound assignment to explicit operation |
expand-event-declaration |
Expand event declaration to explicit add/remove |
extract-class |
Extract methods/fields to new class |
extract-constant |
Extract value to named constant |
extract-function |
Extract code into a new method |
extract-interface |
Create interface from class |
extract-type-to-new-file |
Extract type to new file |
extract-variable |
Extract expression to variable |
extract_expression_from_condition |
Extract sub-expression from condition to named 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_type_declaration_to_new_file |
Extract type declaration to its own file |
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 getters/setters for properties |
generate-base-constructors |
Generate constructors matching base class |
generate-constructor |
Generate constructor from fields |
generate-enum-member |
Generate enum member |
generate-enum-values |
Generate enum values |
generate-event-invoking-method |
Generate method to invoke event |
import-add |
Add a using directive to a C# file |
import-organize |
Sort, group, remove unused |
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-temp |
Inline temporary variable |
inline_alias_expression |
Inline a using alias at its usage site |
inline_constant_value |
Replace constant reference with its literal value |
insert-string-interpolation |
Convert string concatenation to interpolation |
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-and-initialize-field |
Introduce field and initialize it |
introduce-and-initialize-property |
Introduce property and initialize it |
introduce-constructor |
Generate constructor from uninitialized fields |
introduce-field |
Convert local variable to class field |
introduce-local-variable |
Extract expression to local variable |
introduce-property |
Convert local variable to property with getter/setter |
introduce-variable |
Extract expression to local variable |
introduce_field_to_lock_on |
Introduce a dedicated lock field for thread safety |
invert-if-else |
Invert if-else statement by swapping branches and negating condition |
join-string-expressions |
Join multiple string expressions |
merge_if_statements |
Merge nested if statements into a single compound condition |
merge_switch_sections |
Merge switch sections with identical bodies |
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)] |
promote_local_variable_to_parameter |
Promote a local variable to a method parameter |
qualify-name-with-module |
Qualify name with namespace |
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-braces |
Remove unnecessary braces from code blocks |
remove-braces-from-if-else |
Remove braces from single-statement if/else |
remove-unnecessary-assignment |
Remove unnecessary variable assignment |
remove-unused-import |
Remove unused using statement |
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-class |
Rename class and all references |
rename-field |
Rename field and all references |
rename-method |
Rename method and all references |
rename-parameter |
Rename parameter and all references |
rename-property |
Rename property and all references |
rename_identifier_according_to_type_name |
Rename identifier to match its type name (camelCase) |
rename_method_according_to_type_name |
Rename method to reflect return type |
rename_parameter_according_to_type_name |
Rename parameter to camelCase form of its type |
rename_property_according_to_type_name |
Rename property to PascalCase form of its type |
simplify-if |
Simplify if statement logic |
split-if |
Split compound if condition into nested ifs |
split-variable-declaration |
Split variable declaration and initialization |
use-coalesce-expression-instead-of-if |
Replace if-null with coalesce operator |
use-stringbuilder-instead-of-concatenation |
Replace string concatenation with StringBuilder |
use_explicit_type |
Replace var with the explicit type |
use_implicit_type |
Replace explicit type with var |
wrap-lock |
Wrap code in a lock statement |
wrap-using |
Wrap code in a using statement |
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