Skip to main content
Glama

rename

Rename a Python symbol across the project, updating every reference with a safe dry-run preview. Use LSP coordinates to locate the symbol; apply changes only when ready.

Instructions

Rename a Python symbol (function, class, method, variable, module-level name) and update every reference across the project — a binding-aware alternative to find-and-replace. Use your LSP to locate the symbol first; pass its file and 0-based line/character Position (character in UTF-16 units, exactly as the LSP returns). Defaults to a Dry Run that previews the full Blast Radius without writing; set apply=true to write. Supply expected_symbol (the identifier you believe is at the Position) when edits may have happened since your LSP answer — a mismatch fails safely instead of renaming the wrong code. Prefer a clean git working tree before applying, since git is the reversal mechanism; use git diff afterwards for exact text. Occurrences that cannot be proven to refer to this symbol are reported as uncertain_occurrences for you to adjudicate, never silently changed. Keep navigation and reading with your LSP, and formatting with black/ruff — this tool only changes code structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYes
lineYes
rootNo
applyNo
new_nameYes
characterYes
expected_symbolNo
across_class_hierarchyNo
in_docstrings_and_commentsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses the dry-run default, the apply flag for side effects, the expected_symbol safety check, git as reversal mechanism, and that uncertain occurrences are reported rather than silently changed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single dense paragraph but front-loaded with the core action. Every sentence adds operational value, and it avoids redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity and lack of annotations, the description provides thorough coverage: how to locate the symbol, dry-run behavior, when to supply expected_symbol, git considerations, and how uncertain occurrences are handled. It also clarifies scope relative to other tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so description must compensate. It explains file, line/character Position (0-based UTF-16), apply, and expected_symbol in meaningful detail. However, across_class_hierarchy and in_docstrings_and_comments are not mentioned, leaving some parameters under-specified.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States 'Rename a Python symbol... and update every reference across the project' — a specific verb+resource that clearly distinguishes from siblings like move or rewrite. The 'binding-aware alternative to find-and-replace' further clarifies its unique role.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly instructs to use LSP first, and specifies that navigation, reading, and formatting should be done with other tools (LSP, black/ruff), while this tool only changes code structure. Also advises on when to use dry run and clean git tree, giving clear context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/andrewesweet/ropey'

If you have feedback or need assistance with the MCP directory API, please join our Discord server