Skip to main content
Glama

move

Destructive

Relocates a function, class, or entire module to another file while updating all affected imports to prevent broken references.

Instructions

Move a function/class to another file, or a whole module file, and fix every import. Examples: move(name="parse_date", to_file="src/app/dates.py") (one symbol), move(file_path="src/app/util.py", to_file="src/app/common/helpers.py") (the whole module).

With name: moves that module-level function or class (file_path narrows which one). The destination is created if missing. The code travels with the imports it needs (relative ones made absolute), imports only the moved code used are dropped from the old file, and if the old file still uses it, it imports it from the new place (keep_reexport=true always leaves that import so old from old import name keeps working). Every from old import name elsewhere is rewritten. A move that would create a module-level import cycle is refused unless allow_import_cycle=true. Importers the move cannot update (too many, unreadable, unparsable) are reported by name and held back unless apply=true and allow_large=true; uses through the old module (old.name) and strings are listed for you.

Without name: file_path is the module to move or rename (required); every from old import x, import old [as y] and from package import old is rewritten (a relative import stays relative when the module stays in its package, else it becomes absolute). Strings and docs naming the old path are listed.

Writes when the new errors stay within max_new_errors (default 0); else previews with an id for apply_edit; apply=false always previews. undo_edit reverts.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "to_file": "<to_file>"
    },
    "name": "move"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNo
applyNo
to_fileYes
file_pathNo
allow_largeNo
keep_reexportNo
max_new_errorsNo
allow_import_cycleNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.4

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare destructive=true and idempotent=false, and the description adds substantial detail beyond them: side effects on the old file, relocation of imports (relative made absolute), rewriting of every `from old import name`, refusal on module-level import cycles, held-back importers reported by name, and listing of `old.name` uses and strings. It also explains the preview/apply/undo lifecycle and the error-budget gate.

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

Conciseness4/5

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

Front-loaded with the core action and examples, and every clause carries operational meaning, but the second half packs several dense multi-clause sentences (import-cycle and `allow_large` rules) that could be split for faster scanning.

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 an 8-parameter destructive mutation with no output schema, the description covers invocation modes, safety gates, failure reporting, and return behavior (preview id for `apply_edit`, revert via `undo_edit`). Nothing an agent needs to call it correctly or predict consequences is missing.

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?

With 0% schema description coverage, the description carries parameter meaning itself and does so for all eight: `name` (module-level symbol), `file_path` (narrows with name, required without), `to_file` (created if missing), `keep_reexport` (always leaves the old import), `allow_import_cycle` (overrides cycle refusal), `apply` (false always previews), `allow_large` (needed for un-updatable importers), and `max_new_errors` (default 0 gates writes).

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 concrete verb plus resource — 'Move a function/class to another file, or a whole module file, and fix every import' — and immediately disambiguates the two operation modes with runnable examples (`move(name=..., to_file=...)` vs `move(file_path=..., to_file=...)`). An agent can tell which mode applies without opening the schema.

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

Usage Guidelines4/5

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

It clearly explains when to pass `name` versus omitting it, and routes the agent to `apply_edit` for previews and `undo_edit` for reverts. It lacks an explicit 'when not to use this' statement (e.g. cross-package or non-import-managed moves), so a small inference gap remains.

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