[refactoring]
Renames a symbol throughout the solution with semantic awareness. Unlike grep-based renaming, this correctly distinguishes between different symbols with the same name.
| Name | Type | Required | Description |
|---|---|---|---|
| symbolName | string | Yes | Name of the symbol to rename (simple or fully qualified). |
| newName | string | Yes | The new name for the symbol. |
| projectName | string | No | Optional project name to limit the search scope. |
| applyChanges | boolean | No | If true (default), applies changes. If false, returns preview only. |
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 rename 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 files changed, locations modified, and unified diff
Go to Playground to test this tool interactively.