On this page
Reference
ctx_refactor
Input contract and parameters for ctx_refactor.
MCP tool · Search & code intelligence
Call this tool through your MCP client. Its availability depends on your active configuration and profile.
This registry contract is separate from the SDK. For terminal commands, use the CLI reference.
Parameters
Generated from the registered input schema. “Required” reflects the schema; individual actions can impose additional requirements.
actionstringRequiredrename|references|definition|implementations|declaration|type_hierarchy|symbols_overview|inspections|replace_symbol_body|insert_before_symbol|insert_after_symbol|rename_preview|rename_apply|move_preview|move_apply|safe_delete_preview|safe_delete_apply|inline_preview|inline_apply|reformat
columninteger0-indexed column
directionstringsupertypes|subtypes
Accepted: supertypessubtypes
end_lineinteger1-based last line (path+line fallback)
expected_hashstringBLAKE3 hex of current range (TOCTOU guard)
filestringScope name_path resolution to this file (avoids AMBIGUOUS_SYMBOL for common names)
forcebooleanOverride refactoring conflicts
keep_definitionbooleanKeep declaration after inline
lineinteger1-indexed line
modestringrun|list
Accepted: runlist
name_pathstringSymbol path for body edits (qualified or bare)
new_namestringNew symbol name
new_textstringFull replacement declaration text (replace_symbol_body)
optimize_importsbooleanRemove unused imports
pathstringPath
plan_hashstringBLAKE3 plan hash from rename_preview
propagatebooleanDelete unreferenced dependencies
scopestringproject|all
Accepted: projectall
search_commentsbooleanRename in comments/strings
search_text_occurrencesbooleanRename in non-code text
target_parentstringDestination parent symbol for member move
target_pathstringDestination directory/file (project-relative)
textstringSibling text to insert (auto-indented)
Exact JSON schema
Inspect the complete input schema
{
"properties": {
"action": {
"description": "rename|references|definition|implementations|declaration|type_hierarchy|symbols_overview|inspections|replace_symbol_body|insert_before_symbol|insert_after_symbol|rename_preview|rename_apply|move_preview|move_apply|safe_delete_preview|safe_delete_apply|inline_preview|inline_apply|reformat",
"type": "string"
},
"column": {
"description": "0-indexed column",
"type": "integer"
},
"direction": {
"description": "supertypes|subtypes",
"enum": [
"supertypes",
"subtypes"
],
"type": "string"
},
"end_line": {
"description": "1-based last line (path+line fallback)",
"type": "integer"
},
"expected_hash": {
"description": "BLAKE3 hex of current range (TOCTOU guard)",
"type": "string"
},
"file": {
"description": "Scope name_path resolution to this file (avoids AMBIGUOUS_SYMBOL for common names)",
"type": "string"
},
"force": {
"description": "Override refactoring conflicts",
"type": "boolean"
},
"keep_definition": {
"description": "Keep declaration after inline",
"type": "boolean"
},
"line": {
"description": "1-indexed line",
"type": "integer"
},
"mode": {
"description": "run|list",
"enum": [
"run",
"list"
],
"type": "string"
},
"name_path": {
"description": "Symbol path for body edits (qualified or bare)",
"type": "string"
},
"new_name": {
"description": "New symbol name",
"type": "string"
},
"new_text": {
"description": "Full replacement declaration text (replace_symbol_body)",
"type": "string"
},
"optimize_imports": {
"description": "Remove unused imports",
"type": "boolean"
},
"path": {
"description": "Path",
"type": "string"
},
"plan_hash": {
"description": "BLAKE3 plan hash from rename_preview",
"type": "string"
},
"propagate": {
"description": "Delete unreferenced dependencies",
"type": "boolean"
},
"scope": {
"description": "project|all",
"enum": [
"project",
"all"
],
"type": "string"
},
"search_comments": {
"description": "Rename in comments/strings",
"type": "boolean"
},
"search_text_occurrences": {
"description": "Rename in non-code text",
"type": "boolean"
},
"target_parent": {
"description": "Destination parent symbol for member move",
"type": "string"
},
"target_path": {
"description": "Destination directory/file (project-relative)",
"type": "string"
},
"text": {
"description": "Sibling text to insert (auto-indented)",
"type": "string"
}
},
"required": [
"action"
],
"type": "object"
}Runtime description
The following is the tool's own agent-facing description, reproduced from the reviewed registry. It can contain implementation terminology; it does not expand the public stability commitment.
Read the agent-facing description
Rename, move, safe_delete, inline, read-only analyses via LSP/IDE.
WORKFLOW: use action=references first to find usages before refactoring.
ANTIPATTERN: not for symbol discovery — use ctx_symbol/ctx_compose.
Single-phase edits (replace_symbol_body, reformat) work headless via name_path.
Two-phase ops (_preview+_apply) need JetBrains IDE (else BACKEND_REQUIRED).
Conflicts blocked unless force=true. See `action` parameter for full list.Sources & versions
- mcp_manifest.rsrust/src/core/mcp_manifest.rsReviewed checkout
- registry.rsrust/src/server/registry.rsReviewed checkout
- dynamic_tools.rsrust/src/server/dynamic_tools.rsReviewed checkout
- Core checkout
50fbff09c9- Installed runtime
- 3.10.2
- SDK release
- 1.1.0
Separate baselines for source, CLI/configuration and SDK contracts. Review does not certify every platform or integration.
Versions & compatibility