[refactoring]
Semantically renames a symbol across the solution/project.
Try this tool in 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. |
| timeout_ms | number | No | Timeout in milliseconds (5 minutes). Use 0 to disable. Default is 300000. |
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