[refactoring]
Semantically renames a symbol across the solution/project. An applied refactor keeps the line endings each file already has. A file that mixes LF and CRLF is written with the ending it uses most. The unified diff normalizes both sides to LF, so it shows the edit and not the endings.
C# refactors are semantic operations, not search-and-replace operations.
The model can preview or apply semantic changes while preserving symbol identity across overloads, files, and projects.
Try it locally in the Glider playground
| Name | Type | Required | Description |
|---|---|---|---|
| symbolName | string | Yes | Symbol name to rename (simple or fully qualified). |
| newName | string | Yes | New name for the symbol. |
| 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. |
| includeDiff | boolean | No | Include unified diff in response. Default is true. |
| maxDiffChars | number | No | Max diff characters. Use 0 for unlimited. Default is 50000. |
| includePerFileDiff | boolean | No | Include per-file diffs in changedFiles. Default is true. |
| pathStyle | string | No | Path style: 'absolute' (default) or 'relative' (to solution root). |
Rename a class
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "rename_symbol",
"arguments": {
"symbolName": "OldClassName",
"newName": "NewClassName"
}
}
}{
"success": true,
"data": {
"symbolName": "OldClassName",
"newName": "NewClassName",
"symbolKind": "Class",
"filesChanged": 5,
"locationsChanged": 12,
"applied": true,
"unifiedDiff": "..."
},
"error": null
}Preview without applying
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "rename_symbol",
"arguments": {
"symbolName": "OldName",
"newName": "NewName",
"applyChanges": false
}
}
}{
"success": true,
"data": {
"symbolName": "OldClassName",
"newName": "NewClassName",
"symbolKind": "Class",
"filesChanged": 5,
"locationsChanged": 12,
"applied": true,
"unifiedDiff": "..."
},
"error": null
}Returns a unified diff of the change set