RefactorMCP
JSON →Automated refactoring tools for C# code transformation using Roslyn.
Tools · 20
- extract-method Create a new method from selected code and replace the original with a call (expression-bodied methods are not supported).
- introduce-field-parameter-variable Turn expressions into new members; fails if a field already exists.
- convert-to-static Make instance methods static using parameters or an instance argument.
- move-static-method Relocate a static method and keep a wrapper in the original class.
- move-instance-method Move one or more instance methods to another class and delegate from the source. If a moved method no longer accesses instance members, it is made static automatically. Provide a methodNames list along with optional constructor-injections and parameter-injections to control dependencies.
- move-multiple-methods-instance Move several methods and keep them as instance members of the target class. The source instance is injected via the constructor when required.
- move-multiple-methods-static Move multiple methods and convert them to static, adding a this parameter.
- make-static-then-move Convert an instance method to static and relocate it to another class in one step.
- move-type-to-separate-file Move a top-level type into its own file named after the type.
- make-field-readonly Move initialization into constructors and mark the field readonly.
- transform-setter-to-init Convert property setters to init-only and initialize in constructors.
- constructor-injection Convert method parameters to constructor-injected fields or properties.
- safe-delete Remove fields or variables only after dependency checks.
- extract-class Create a new class from selected members and compose it with the original.
- inline-method Replace calls with the method body and delete the original.
- extract-decorator Create a decorator class that delegates to an existing method.
- create-adapter Generate an adapter class wrapping an existing method.
- add-observer Introduce an event and raise it from a method.
- use-interface Change a method parameter type to one of its implemented interfaces.
- list-tools Display all available refactoring tools as kebab-case names.
Links
★ 88 GitHub stars