move
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
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| apply | No | ||
| to_file | Yes | ||
| file_path | No | ||
| allow_large | No | ||
| keep_reexport | No | ||
| max_new_errors | No | ||
| allow_import_cycle | No |