Skip to main content
Glama

rename_symbol

Rename a symbol across the workspace with LSP-aware refactoring that avoids unintended matches, previewing changes before applying.

Instructions

Rename a symbol throughout the workspace using LSP semantic refactoring.

The language server identifies every reference across all files and applies a precise edit set atomically. Safer than text find-and-replace: it understands scope, shadowing, and types, so it won't rename unrelated identifiers that share the name.

Prefer symbol_name to identify the symbol; plumb resolves it through the document-symbol tree and queries the language server at the exact identifier position. Raw line/character remains supported and recovers from narrow "no identifier" misses by snapping once to the enclosing symbol. Runs in dry_run mode by default; set dry_run=false to apply. The response appends a per-file unified diff (a preview in dry-run, the applied change otherwise), capped at 20 files, unless show_write_diff is disabled.

If the language server cannot compute the rename (an error, or an empty edit set — common with sourcekit-lsp before the build graph resolves), pass structural_fallback=true to attempt a best-effort identifier-boundary text rename via find_replace (still dry_run by default). The fallback is NOT scope-aware — it renames every whole-word occurrence in same-extension files — so review the preview before applying.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uriNoAbsolute path, file:// URI, or workspace-relative path.
lineNoZero-based line of the identifier. Required when symbol_name is not provided.
dry_runNoIf true (default), preview changes only.
dirty_okNoAllow editing target files with uncommitted changes. Default false — review/commit first, or pass true to proceed.
new_nameYesReplacement identifier name.
characterNoZero-based character offset within the line. Required when symbol_name is not provided.
symbol_nameNoSymbol name to rename instead of a raw position — PREFERRED over line/character. Accepts plain name or ReceiverType.MethodName form. When provided, line and character are not needed.
structural_fallbackNoIf true, and the language server cannot compute the rename, attempt a best-effort, identifier-boundary text rename via find_replace (NOT scope-aware; honours dry_run). Default false.
Behavior5/5

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

No annotations are present, so the description carries full burden. It discloses atomic edits, dry_run default, response diff preview capped at 20 files, fallback not being scope-aware ('renames every whole-word occurrence'), and dirty_ok behavior. These are concrete behavioral traits beyond the schema's parameter descriptions.

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?

Every sentence earns its place. The description is organized into three focused paragraphs: core semantics, parameter guidance, and fallback behavior. No fluff; even the repeated dry_run reminder reinforces safety-critical information.

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 that there is no output schema and no annotations, the description fully compensates: it explains the tool's purpose, identification methods, default behavior, response format (per-file unified diff capped at 20 files), fallback conditions, and limitations. For a complex LSP-dependent tool, this is complete enough for an agent to select and invoke it correctly.

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

Parameters5/5

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

Schema coverage is 100%, but the description adds meaning beyond the schema: it specifies symbol_name is preferred over line/character, explains how plumb resolves it through the document-symbol tree, and describes snapping recovery for raw positions. It also clarifies when structural_fallback should be used relative to language server failures.

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?

Description opens with 'Rename a symbol throughout the workspace using LSP semantic refactoring' – a specific verb, resource, and mechanism. It explicitly distinguishes itself from text find-and-replace by mentioning scope/shadowing/type awareness, which differentiates it from sibling find_replace and rename_file.

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?

Provides explicit usage guidance: 'Prefer symbol_name to identify the symbol', explains when fallback is appropriate ('If the language server cannot compute the rename... pass structural_fallback=true'), and contrasts with find-and-replace ('Safer than text find-and-replace') to aid tool selection. It also notes dry_run default and review-before-apply for the fallback.

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/plumbkit/plumb'

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