create_file
Creates a text document in an Overleaf project, optionally writing non-empty initial content as tracked changes for controlled edits.
Instructions
Create a text document and optionally record non-empty initial content as tracked changes. The content is written as by write_file once the empty document exists, so on a ShareJS (legacy editor) document, content that adds an emoji or other character outside the Basic Multilingual Plane is refused with INVALID_ARGUMENT; a timeout, a lost socket, or an Overleaf error after sending is observed, never resent; content the account may not write, such as untracked content from a review-only collaborator, is PERMISSION_DENIED before it is sent; and tracked content Overleaf applied without recording it as tracked changes by this account is PROTOCOL_UNSUPPORTED with details.kind applied_untracked, live and not reverted. If reading back or writing the content fails after the document was created, the error keeps its code and adds details.created: true; the document then exists, possibly empty, so do not create it again: read it with read_file and write the content with write_file.
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>",
"filePath": "<filePath>"
},
"name": "create_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | No | ||
| filePath | Yes | Project-relative path using forward slashes | |
| projectId | Yes | Overleaf project ID | |
| writeMode | No | Use tracked to record inserted and deleted text as Overleaf tracked changes; defaults to untracked | untracked |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| protocol | Yes | ||
| revision | Yes | ||
| writeMode | Yes | ||
| trackChangesActive | Yes | ||
| recoveredAfterTimeout | No |