Skip to content
Documentation

Reference

ctx_refactor

Input contract and parameters for ctx_refactor.

Status by featureReviewed September 2026

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.

actionstringRequired

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

columninteger

0-indexed column

directionstring

supertypes|subtypes

Accepted: supertypessubtypes

end_lineinteger

1-based last line (path+line fallback)

expected_hashstring

BLAKE3 hex of current range (TOCTOU guard)

filestring

Scope name_path resolution to this file (avoids AMBIGUOUS_SYMBOL for common names)

forceboolean

Override refactoring conflicts

keep_definitionboolean

Keep declaration after inline

lineinteger

1-indexed line

modestring

run|list

Accepted: runlist

name_pathstring

Symbol path for body edits (qualified or bare)

new_namestring

New symbol name

new_textstring

Full replacement declaration text (replace_symbol_body)

optimize_importsboolean

Remove unused imports

pathstring

Path

plan_hashstring

BLAKE3 plan hash from rename_preview

propagateboolean

Delete unreferenced dependencies

scopestring

project|all

Accepted: projectall

search_commentsboolean

Rename in comments/strings

search_text_occurrencesboolean

Rename in non-code text

target_parentstring

Destination parent symbol for member move

target_pathstring

Destination directory/file (project-relative)

textstring

Sibling 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 & versions3 references Reviewed
  • 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