batch_upload
Upload multiple local files to explicit project paths in one call, with per-file conflict handling for fail, skip, or overwrite. Use it instead of sending one upload call per file.
Instructions
Upload a list of local files to explicit project paths in one call, instead of one upload_file call per file. Each destinationPath is the full project path including the file name; missing folders are created. onConflict decides what happens when a document or file is already at a destination path: "fail", the default, refuses the whole call with CONFIRMATION_MISMATCH listing those paths, before anything is uploaded; "skip" leaves them untouched and lists them in skipped; "overwrite" replaces a binary file. Replacing a text document has no revision check, so with "overwrite" each one also needs uncheckedDocumentReplace: true, else that file fails with INVALID_ARGUMENT; use write_file or sync_directory for documents a collaborator may be editing. A folder at a destination path, or a file where a folder is needed, fails that file in any mode. Every path is checked before anything is sent: a duplicate destination or a missing local file fails the call with nothing uploaded. Failures are per file and nothing is retried: the call continues past a failure unless stopOnError, and stops at RATE_LIMITED (Overleaf allows about 500 uploads per project in 15 minutes). It returns status, completed (with replaced per upload), skipped, failed, remaining, and verified, which is true when the tree read back afterwards confirmed every completed entry. A timed-out upload is classified from that read-back, never resubmitted: recoveredAfterTimeout when the path holds the local bytes, OUTCOME_UNKNOWN when the tree cannot tell. It saves tool calls, not time. Confirm overwrites with the user first.
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": {
"projectId": "<projectId>",
"files": "<files>"
},
"name": "batch_upload"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | Files to upload, in order; at most 500 | |
| projectId | Yes | Overleaf project ID | |
| onConflict | No | What to do when a document or file is already at a destination path; fail (the default) uploads nothing | fail |
| stopOnError | No | Stop at the first failure instead of continuing | |
| uncheckedDocumentReplace | No | Allow replacing a text document, a blind write with no revision check; prefer write_file with localPath when a collaborator may be editing |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| failed | Yes | ||
| status | Yes | ||
| skipped | Yes | ||
| verified | Yes | ||
| completed | Yes | ||
| remaining | Yes | ||
| onConflict | Yes |