Browse documentation

move_member

[refactoring]

Moves a member to another type and updates static type-qualified references.

Before you use this tool

Writes files by default. Set applyChanges: false to preview the diff. Inspect the diff before application. 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

NameTypeRequiredDescription
memberSymbolKeystringNoExact source member key. Requires targetTypeSymbolKey. Do not combine keys with names or projectName.
targetTypeSymbolKeystringNoTarget source type key. Requires memberSymbolKey and one target source declaration.
memberNamestringNoUnique member name for name mode. Overloads require keys.
sourceTypeNamestringNoUnique source type name for name mode.
targetTypeNamestringNoUnique target type name for name mode.
projectNamestringNoOptional project name to limit search.
applyChangesbooleanNoIf true (default), applies changes to disk. If false, returns a preview diff. Default: true
maxReferenceUpdatesnumberNoMaximum reference updates when rewriting call sites. Use 0 to disable. Default is 2000. Default: 2000
formatAfterbooleanNoFormat changed documents after the move. Default is false. Default: false
organizeUsingsAfterbooleanNoOrganize usings in changed documents after the move. Default is false. Default: false
includeDiffbooleanNoInclude unified diff in response. Default is true. Default: true
maxDiffCharsnumberNoMax diff characters. Use 0 for unlimited. Default is 50000. Default: 50000
includePerFileDiffbooleanNoInclude per-file diffs in changedFiles. Default is true. Default: true
pathStylestringNoPath style: 'absolute' (default) or 'relative' (to solution root). Default: "absolute"
responseDetailstringNocompact 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

Arguments
{
  "memberName": "ProcessData",
  "sourceTypeName": "OldClass",
  "targetTypeName": "NewClass",
  "applyChanges": false
}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "move_member",
    "arguments": {
      "memberName": "ProcessData",
      "sourceTypeName": "OldClass",
      "targetTypeName": "NewClass",
      "applyChanges": false
    }
  }
}
Illustrative response
{
  "success": true,
  "symbolName": "MyMethod",
  "symbolKind": "Method",
  "sourceLocation": "SourceClass",
  "targetLocation": "TargetClass",
  "filesChanged": 2,
  "filesCreated": 0,
  "applied": false,
  "unifiedDiff": "...",
  "workspaceUpdate": null
}

Preview an exact overload move

Arguments
{
  "memberSymbolKey": "<member key from search_symbols>",
  "targetTypeSymbolKey": "<target type key from search_symbols>",
  "applyChanges": false
}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "move_member",
    "arguments": {
      "memberSymbolKey": "<member key from search_symbols>",
      "targetTypeSymbolKey": "<target type key from search_symbols>",
      "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. Stale keys fail. Results use top-level fields with success. Compact is the default; full adds responseDiagnostics. Both modes retain errors, coverage, partial state, and recovery advice.