Skip to main content
Glama

move_symbol

Move a declaration between files in the same directory atomically, preserving its doc comment and rolling back on failure.

Instructions

Move a top-level declaration (function, method, type, const, or var) from one file to another within the SAME directory/package, atomically. The symbol's full source — declaration plus, by default, its leading doc comment (include_doc_comment) — moves from source_uri to destination_uri in one all-or-nothing operation: if the destination write fails the source is rolled back. Locates the symbol via the LSP document-symbol tree, falling back to tree-sitter when the language server is cold.

Scope (v1, conservative): source and destination must be in the SAME directory — plumb does not rewrite references or imports, so a move that would change a symbol's package or import path is REFUSED. destination_uri must already exist unless create_destination=true. Also refuses an ambiguous symbol (disambiguate with name_path), a path outside the workspace, or (Go) mismatched build constraints between source and destination.

Dry-run by default (dry_run=true): previews the unified diff without writing; set dry_run=false to apply. Undo is per-file — reverting a move takes two undo_edit calls. Scope rationale: the plumb-refactor skill.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dry_runNoIf true (default), preview the diff of both files only; do not write.
dirty_okNoAllow moving when either file has uncommitted changes. Default false — review/commit first, or pass true to proceed.
name_pathYesSlash-separated symbol path within the source file (e.g. "ClassName/methodName", or just "funcName" for a top-level declaration).
source_uriYesAbsolute path, file:// URI, or workspace-relative path of the file currently holding the symbol.
destination_uriYesAbsolute path, file:// URI, or workspace-relative path of the file to move the declaration into. Must be in the SAME directory (package) as source_uri.
create_destinationNoCreate destination_uri if it does not exist. Default false (the destination must already exist). A newly created Go file is seeded with the source file's package clause.
include_doc_commentNoMove the symbol's contiguous leading doc comment along with it. Default true — a relocated declaration should keep its documentation. Where the declaration is WRAPPED (an exported ES declaration under its export statement, a decorated Python def under its @decorator) its doc comment sits above the wrapper, so the moved range covers the wrapper too — which is what keeps @property with the method it decorates.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  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?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It does this thoroughly: atomicity (all-or-nothing with rollback), dry-run default, undo semantics (per-file, two undo_edit calls), refusal conditions (ambiguous symbol, path outside workspace, Go build-constraint mismatch), and the doc-comment wrapping behavior (ES export wrapper, Python decorator). It even explains the fallback from LSP to tree-sitter. This is exemplary transparency for a mutation tool with zero annotation coverage.

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 dense but well-structured: a clear first sentence stating the core operation, then a 'Scope (v1, conservative)' section for constraints, then a 'Dry-run by default' section for behavior. Every sentence earns its place — the atomicity, rollback, refusal conditions, and undo semantics are all critical for correct invocation. The front-loading of the core operation and the scoped constraints makes it easy for an agent to quickly determine applicability. No fluff or repetition.

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?

For a complex mutation tool with 7 parameters, no annotations, and no output schema, the description is remarkably complete. It covers the operation's semantics (atomic move), constraints (same-directory, refusal conditions), defaults (dry_run, include_doc_comment), edge cases (wrapped declarations, Go package seeding), and post-conditions (undo requires two calls). The only minor gap is the exact return format of the dry-run diff, but the description says 'previews the unified diff' which is sufficient for an agent to know what to expect. Nothing critical is missing.

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 description coverage is 100%, so the schema already documents all 7 parameters. The description adds value beyond the schema by explaining the atomicity of the operation, the doc-comment wrapping edge cases (which clarify include_doc_comment), the rollback behavior, and the refusal conditions that affect how parameters like name_path and destination_uri are used. It doesn't add syntax details for the URI formats (the schema already covers those), but it enriches the semantics of the move operation itself. A 4 is appropriate because the description complements the schema without redundancy.

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?

The description states a specific verb ('Move'), a specific resource ('a top-level declaration... from one file to another'), and precise scope constraints (SAME directory/package, atomic). It clearly distinguishes this from siblings like rename_symbol, insert_before_symbol, replace_symbol_body, and safe_delete_symbol by describing the atomic move semantics and the refusal conditions. The purpose is unambiguous and actionable.

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?

The description explicitly states when to use the tool (moving a top-level declaration between files in the same directory) and when NOT to use it (cross-directory moves that would change package/import paths are refused; ambiguous symbols are refused; Go build-constraint mismatches are refused). It also names the alternative for disambiguation (name_path) and the dry-run default, giving the agent clear decision criteria. The scope rationale ('plumb-refactor skill') further anchors usage context.

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

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