rename_symbol
[refactoring]
Renames a C# symbol and its references across the loaded workspace.
Before you use this tool
Writes files by default. Set applyChanges: false to preview the diff. Inspect the diff before application.
Try it locally in the Glider playground
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| symbolName | string | Yes | Opaque symbolKey from discovery (preferred), or a simple or fully qualified symbol name. |
| 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. Default: true |
| includeDiff | boolean | No | Include unified diff in response. Default is true. Default: true |
| maxDiffChars | number | No | Max diff characters. Use 0 for unlimited. Default is 50000. Default: 50000 |
| includePerFileDiff | boolean | No | Include per-file diffs in changedFiles. Default is true. Default: true |
| pathStyle | string | No | Path style: 'absolute' (default) or 'relative' (to solution root). Default: "absolute" |
| responseDetail | string | No | compact returns results and actionable state. full adds diagnostic metadata under responseDiagnostics. Default: "compact" |
Examples
Replace sample paths and symbol keys with values from your workspace.
Rename a class
{
"symbolName": "OldClassName",
"newName": "NewClassName"
}Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "rename_symbol",
"arguments": {
"symbolName": "OldClassName",
"newName": "NewClassName"
}
}
}{
"success": true,
"symbolName": "OldClassName",
"newName": "NewClassName",
"symbolKind": "Class",
"filesChanged": 5,
"locationsChanged": 12,
"applied": true,
"unifiedDiff": "..."
}Preview without applying
{
"symbolName": "OldName",
"newName": "NewName",
"applyChanges": false
}Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "rename_symbol",
"arguments": {
"symbolName": "OldName",
"newName": "NewName",
"applyChanges": false
}
}
}Preview a rename by key
{
"symbolName": "<symbol key from search_symbols>",
"newName": "NewName",
"applyChanges": false
}Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "rename_symbol",
"arguments": {
"symbolName": "<symbol key from search_symbols>",
"newName": "NewName",
"applyChanges": false
}
}
}Response Notes
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.
Returns a unified diff of the change set Results use top-level fields with success. Compact is the default; full adds responseDiagnostics. Both modes retain errors, coverage, partial state, and recovery advice.