Delete, move, upload or restore files and folders
manage_filesDeletes, moves, uploads or restores files in an Overleaf project's local clone, or discards local changes, staging all edits until you push them to Overleaf.
Instructions
Change which files and directories the project's local clone holds, or throw local work away; action picks what. delete removes a file, or a directory with everything in it. move renames a file or a directory or moves it inside the project, creating missing parent directories and refusing a toPath that already exists or lies inside the directory being moved. upload adds a file byte for byte, such as a figure, a PDF, a data file or a .bib from elsewhere, copied from sourcePath on this computer or decoded from contentBase64, and replaces a file already at path; edit_file is for text written in the call itself. restore puts a file back to exactly what it was at revision, binary files included, and brings back a file deleted since; find the revision with read_history. discard_local_changes permanently throws away every local edit, new file and unpushed commit in the project, fetching Overleaf first so the clone ends up matching its current version; call it only once the user has said the work should be abandoned, typically after push_changes refuses a conflicting change. Nothing reaches Overleaf until push_changes, and until then discard_local_changes undoes any of these; review them with read_project (view changes). LaTeX references are not rewritten: after a move or delete, search_project for the old path and fix what still names it with edit_file. Uploads over 50 MB and files under a hidden directory such as ~/.ssh are refused. An upload turns off text-only checkout for the project so the new file is committed with the rest, and so does deleting or moving a directory that holds files text-only checkout keeps off disk, so those files go with it. Every action except discard_local_changes pulls from Overleaf first, and fails, keeping local work, if that pull conflicts with it. Returns what was changed, or why nothing was.
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": {
"action": "<action>"
},
"name": "manage_files"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | delete, move, upload and restore, required: a path relative to the project root, as read_project (view files) prints it, e.g. sections/intro.tex. delete and move take a file or a directory, move at its current path; upload and restore take the file to write. | |
| action | Yes | What to do: delete, move, upload, restore (a file from an earlier revision) or discard_local_changes (every local change in the project, permanently). | |
| toPath | No | move, required: the new path, relative to the project root, e.g. sections/intro.tex. Must stay inside the project and must not already exist. | |
| project | No | Which project to use: its Overleaf address, its 24-character id, or a registered project name. Omit to use the default project. | |
| revision | No | restore, required: the commit hash to restore the file from, as read_history prints it. | |
| sourcePath | No | upload: absolute path of the file on this computer to copy, e.g. /Users/me/results/plot.png. Give this or contentBase64. | |
| contentBase64 | No | upload: the file's content, base64-encoded, for content that is not on disk. Give this or sourcePath. |