move_member
[refactoring]
Moves a member to another type and updates static type-qualified references.
Before you use this tool
Writes files by default. An authorized, unambiguous edit with a clear scope can apply directly. Set applyChanges: false for a preview without file writes. Preview when the user requests inspection only, the scope is unclear, or a broad refactor needs inspection. Name mode requires all three names and unique matches. Ambiguity errors return candidate keys without edits. Key mode supports ordinary methods, properties, fields, and events. Partial methods, accessors, constructors, implicit members, shared field or event declarations, and targets with multiple source declarations are unsupported. Generic targets, including types inside generic containing types, are unsupported.
Try it locally in the Glider playground
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| memberSymbolKey | string | No | Exact source member key. Requires targetTypeSymbolKey. Do not combine keys with names or projectName. |
| targetTypeSymbolKey | string | No | Target source type key. Requires memberSymbolKey and one target source declaration. |
| memberName | string | No | Unique member name for name mode. Overloads require keys. |
| sourceTypeName | string | No | Unique source type name for name mode. |
| targetTypeName | string | No | Unique target type name for name mode. |
| projectName | string | No | Optional project name to limit search. |
| applyChanges | boolean | No | If true (default), applies changes to disk. If false, returns a preview diff. Default: true |
| maxReferenceUpdates | number | No | Maximum reference updates when rewriting call sites. Use 0 to disable. Default is 2000. Default: 2000 |
| formatAfter | boolean | No | Format changed documents after the move. Default is false. Default: false |
| organizeUsingsAfter | boolean | No | Organize usings in changed documents after the move. Default is false. Default: false |
| 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 diffs in changedFiles independently of includeDiff. File paths and counts remain available when false. Development builds after 13.4.0 default to false; released 13.4.0 defaults to true. Follow the installed schema. Default: false |
| 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.
Preview a method move to another class
{
"memberName": "ProcessData",
"sourceTypeName": "OldClass",
"targetTypeName": "NewClass",
"applyChanges": false
}Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "move_member",
"arguments": {
"memberName": "ProcessData",
"sourceTypeName": "OldClass",
"targetTypeName": "NewClass",
"applyChanges": false
}
}
}{
"success": true,
"symbolName": "MyMethod",
"symbolKind": "Method",
"sourceLocation": "SourceClass",
"targetLocation": "TargetClass",
"filesChanged": 2,
"filesCreated": 0,
"applied": false,
"unifiedDiff": "...",
"workspaceUpdate": null
}Preview an exact overload move
{
"memberSymbolKey": "<member key from find_code>",
"targetTypeSymbolKey": "<target type key from find_code>",
"applyChanges": false
}Full MCP request
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "move_member",
"arguments": {
"memberSymbolKey": "<member key from find_code>",
"targetTypeSymbolKey": "<target type key from find_code>",
"applyChanges": false
}
}
}Response Notes
It updates static type-qualified references. Other reference forms require manual edits. 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. Name mode requires all three names and unique matches. Ambiguity errors return candidates with symbolKey fields, without edits. Partial methods, accessors, constructors, implicit members, shared field or event declarations, and targets with multiple source declarations are unsupported. Generic targets, including types inside generic containing types, are unsupported. Keys absent from the selected workspace fail.
Unreleased development builds after 13.4.0 return one unified diff by default; the example uses that contract. Follow the installed schema for supported parameters and defaults. Set includeDiff=false for compact output, with includePerFileDiff=false where supported. Set includePerFileDiff=true only when separate file diffs are needed; it works independently of includeDiff. These controls preserve application state, file metadata, counts, and any diagnostics, errors, conflicts, or limits the tool reports. Results use top-level fields with success. Compact is the default; full adds responseDiagnostics. Both modes retain errors, coverage, partial state, and recovery advice.
For a failed symbol-key request, success=false includes errorCode, parameter, error, and suggestions in compact, full, and batch operation results. Batch keeps a bounded summary outside the requested detail budget. If the hard server limit omits details, failureDetailsOmitted or writeStateOmitted identifies the omission. errorCode is invalid_symbol_key, symbol_not_found, ambiguous_symbol_key, wrong_symbol_kind, source_unavailable, unsupported_symbol, or invalid_arguments. Follow the suggestions for the specific failure. Correct the named selector for invalid_arguments. For symbol_not_found, repeat discovery in the selected workspace and pass a returned key unchanged. An absent identity does not prove that a key is stale.