[refactoring]
Moves a type to a different file and/or namespace and updates references.
Try this tool in Playground.
| Name | Type | Required | Description |
|---|---|---|---|
| typeName | string | Yes | Type name to move (simple or fully qualified). |
| targetFilePath | string | No | Optional target file path. |
| targetNamespace | string | No | Optional target namespace. |
| projectName | string | No | Optional project name to limit symbol search. |
| applyChanges | boolean | No | If true (default), applies changes to disk. If false, returns a preview diff. |
| timeout_ms | number | No | Timeout in milliseconds (5 minutes). Use 0 to disable. Default is 300000. |
Move a type to a new namespace
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "move_type",
"arguments": {
"typeName": "MyClass",
"targetNamespace": "MyApp.Utils"
}
}
}{
"success": true,
"data": {
"symbolName": "MyClass",
"symbolKind": "Class",
"sourceLocation": "/path/to/OldFile.cs",
"targetLocation": "/path/to/NewFile.cs",
"filesChanged": 3,
"filesCreated": 1,
"applied": true,
"unifiedDiff": "..."
},
"error": null
}Returns a unified diff of the change set