Skip to main content
Glama

rename_file

Move a file to a new location, creating missing parent directories and notifying the LSP server for immediate symbol index updates. Prevents accidental overwrites unless explicitly allowed.

Instructions

Move (rename) a file. Parent directories of to are created if missing. Refuses to overwrite an existing destination unless overwrite=true. The LSP server is notified with FileDeleted (source) and FileCreated (destination) so symbol indexes and diagnostics update immediately. A rename changes no content, so the response shows a diff only when the move destroyed an existing destination (that destination's content), gated by [edits].show_write_diff. To duplicate a file without removing the source, use copy_file instead. For LSP-semantic identifier renames across files, use rename_symbol instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNoAbsolute path, file:// URI, or workspace-relative path of the destination file. Parent directories are created automatically.
fromNoAbsolute path, file:// URI, or workspace-relative path of the source file.
dirty_okNoAllow moving a file that has uncommitted changes in its git repository. Default false — the move is refused if the source file is dirty. Pass true to proceed anyway.
overwriteNoAllow overwriting an existing destination file. Default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.16.6

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries full burden and does so richly: parent-directory auto-creation, refuse-to-overwrite unless overwrite=true, LSP notification semantics (FileDeleted/FileCreated) with index/diagnostic implications, and diff behavior gated by edits.show_write_diff. This is far beyond what the schema provides.

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?

Front-loaded core action, then preconditions, side effects, and alternatives in a tight sequence. Every sentence earns its place with no filler.

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?

No output schema exists, but the description explains the response behavior (diff only when overwrite destroyed content, gated by show_write_diff) and the LSP side effects. For a no-annotation mutation tool, this is complete.

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 100%, so baseline is 3. The description adds value by explaining the overwrite gate, parent-directory creation, and the meaning of dirty_ok indirectly via the dirty-file refusal clause, though it does not restate each parameter explicitly.

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 a specific verb+resource ("Move (rename) a file") and explicitly distinguishes itself from copy_file and rename_symbol by naming what each does differently. An agent can disambiguate from all siblings without opening a schema.

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 routes to alternatives: copy_file for duplication without removing source, rename_symbol for LSP-semantic identifier renames. It also states the overwrite precondition and dirty-file refusal behavior, covering when and when-not to use.

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