rename_symbol

[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.

Why this tool exists

C# refactors are semantic operations, not search-and-replace operations.

How it helps the agent

The model can preview or apply semantic changes while preserving symbol identity across overloads, files, and projects.

Try it locally in the Glider playground

Parameters

NameTypeRequiredDescription
symbolNamestringYesSymbol name to rename (simple or fully qualified).
newNamestringYesNew name for the symbol.
projectNamestringNoOptional project name to limit symbol search.
applyChangesbooleanNoIf true (default), applies changes to disk. If false, returns a preview diff.
includeDiffbooleanNoInclude unified diff in response. Default is true.
maxDiffCharsnumberNoMax diff characters. Use 0 for unlimited. Default is 50000.
includePerFileDiffbooleanNoInclude per-file diffs in changedFiles. Default is true.
pathStylestringNoPath style: 'absolute' (default) or 'relative' (to solution root).

Examples

Rename a class

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "rename_symbol",
    "arguments": {
      "symbolName": "OldClassName",
      "newName": "NewClassName"
    }
  }
}
Response
{
  "success": true,
  "data": {
    "symbolName": "OldClassName",
    "newName": "NewClassName",
    "symbolKind": "Class",
    "filesChanged": 5,
    "locationsChanged": 12,
    "applied": true,
    "unifiedDiff": "..."
  },
  "error": null
}

Preview without applying

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "rename_symbol",
    "arguments": {
      "symbolName": "OldName",
      "newName": "NewName",
      "applyChanges": false
    }
  }
}
Response
{
  "success": true,
  "data": {
    "symbolName": "OldClassName",
    "newName": "NewClassName",
    "symbolKind": "Class",
    "filesChanged": 5,
    "locationsChanged": 12,
    "applied": true,
    "unifiedDiff": "..."
  },
  "error": null
}

Response Notes

Returns a unified diff of the change set

↑/↓ NavigateEnter OpenSpace Expand