api.tools

moveDocument

tools: { move_document: api.tools.moveDocument }

Lets a run move or rename a file or a folder on the caller's computer. It never overwrites, so a collision is a refusal rather than a loss.

declaration onlyfreenever overwrites
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

A declaration. The move is performed on the machine, by the package, in the process that holds the key.

What the model sends

{ "from": "draft.md", "to": "Archive/2026/draft.md" }
{"from": "draft.md", "to": "Archive/2026/draft.md"}
fromstringrequired

What to move — a file or a folder.

tostringrequired

Where it goes. Its parent folders are created.

// What the run reports back
{ from: "draft.md", path: "Archive/2026/draft.md" }
# What the run reports back
{"from": "draft.md", "path": "Archive/2026/draft.md"}

A taken destination is refused

Nothing is replaced: a destination that exists stops the move, with both paths named. The model can then pick another name — which is a far better outcome than a file quietly replaced by one with the same name and different content.

Renaming is the same call

A move within one folder is a rename. There is no second tool for it, and no flag: the destination path says everything.

This is also how a file is archived

Moving into a dated folder keeps the history readable without any deletion. An agent told to « tidy up » can do all of it with this one tool, and every step is reversible by another move.

A folder cannot go inside itself

Work into Work/old is refused before anything moves. Left to the filesystem that operation fails halfway, with part of the tree already elsewhere.

It runs on the caller's computer, through the package

The server cannot reach a disk. When the agent calls this, the run asks the machine that holds the key to perform it, the package does the work there, and the answer goes back into the run. So it only works while your process is listening — and nothing of the file ever travels to be written.

Refusals the run reports

  • Nothing at from.
  • to already taken.
  • A folder moved into itself.
  • A path outside the workspace, an absolute one, or the root.