Skip to main content

Overview

The rename tool performs safe, multi-file coordinated renaming of code symbols by combining knowledge graph relationships (high confidence) with regex text search (lower confidence). It previews changes by default and tags each edit with its confidence level.
When to use: Renaming a function, class, method, or variable across the codebase. Safer than find-and-replace.Next step: Run detect_changes() to verify no unexpected side effects.

Parameters

string
Current symbol name to rename (e.g., “validateUser”, “AuthService”)Required unless symbol_uid is provided.
string
Direct symbol UID from prior tool results for zero-ambiguity lookupWhen available, prefer this over symbol_name to avoid disambiguation.
string
required
The new name for the symbolMust be a valid identifier for the symbol’s language.
string
File path to disambiguate common names when multiple symbols share the same nameExample: "src/auth/validator.ts"
boolean
default:true
Preview edits without modifying files
  • true (default): Show what would be changed
  • false: Apply changes to disk
Always review the dry run results before setting this to false.
string
Repository name or path. Required when multiple repos are indexed.
At least one of symbol_name or symbol_uid must be provided.

Response

array
required
All proposed edits grouped by file
object
required
High-level summary of proposed changes
boolean
required
Whether changes were applied to disk (true) or just previewed (false)

Example Usage

Preview Rename (Default)

Apply Rename

Rename with UID (Zero-Ambiguity)

Disambiguate by File Path

Multi-Repo Rename

Example Response (Dry Run)

Confidence Levels

Source: Knowledge graph relationshipsSafety: High — these are actual code references tracked by the graphExamples:
  • Function calls
  • Import statements
  • Class instantiations
  • Method invocations
Action: Generally safe to accept
Source: Regex text searchSafety: Lower — may include false positives like comments, strings, or unrelated matchesExamples:
  • References in config files
  • String literals
  • Comments
  • Dynamic references
Action: Review carefully, may need manual adjustment

Real-World Examples

Example 1: Safe Rename Workflow

Example 2: Class Rename

Example 3: Method Rename

Best Practices

Never skip the preview. Review the changes, especially text_search edits, before applying.
If you have a symbol_uid from query() or context() results, use it to avoid ambiguity.
Graph edits are safe, but text_search edits may include false positives (comments, strings, unrelated code).
After applying the rename, run detect_changes() to verify only expected files were modified.
Before renaming widely-used symbols, run impact() to understand the blast radius.
Rename operations can touch many files. Commit immediately after a successful rename to isolate it from other changes.

Workflow Checklist

Use Cases

  • Function renaming: Better naming for clarity
  • Class renaming: Architecture refactoring
  • Method renaming: API improvements
  • Variable renaming: Code quality improvements
  • Refactoring prep: Rename before extracting modules

Limitations

String Literals and Dynamic ReferencesThe rename tool cannot detect:
  • Dynamic property access: obj["validateUser"]()
  • String literals in external configs
  • References in non-indexed files
Solution: Use text_search results and manual review to catch these cases.
  • impact - Analyze blast radius before renaming
  • detect_changes - Verify rename scope after applying
  • context - Understand symbol usage before renaming
  • gitnexus://repo/{name}/processes - See which flows use the symbol