# moveDocument

Canonical URL: https://developers.iagenify.com/sdk/ref/tools/move-document/
Language: en

`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.

Status: declaration only · free · never overwrites

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

## What the model sends {#arguments}

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

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `from` | string | required | What to move — a file or a folder. |
| `to` | string | required | Where it goes. Its parent folders are created. |

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

## A taken destination is refused {#no-overwrite}

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 {#rename}

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 {#folders}

`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 {#refusals}

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

- [deleteDocument](/sdk/ref/tools/delete-document): The deletion, which is itself a move.
- [files.move()](/sdk/ref/local-files/move): The same operation from your own code.
- [api.tools](/sdk/ref/tools): The fifteen, and the two ways to use them.

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

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