write_section
Replace a LaTeX section body in one file using a revision-checked write, optionally as tracked changes, refusing conflicting or multi-file edits before anything is sent.
Instructions
Replace one section body in a single file using a revision-checked write, optionally recorded as tracked changes. By default included files are not traversed. With followIncludes: true, filePath is the document get_sections started from, sectionId comes from that call, and revision is the section's revision from it: the body is replaced in the file holding the heading, through the same revision-checked write, and filePath in the result names that file. The revision is checked against that file first: a file changed since get_sections is REVISION_CONFLICT with details.filePath and details.liveRevision, and nothing is sent. A section with spansFiles: true is refused with INVALID_ARGUMENT, details.kind spans_files, before anything is sent; edit each file with write_file instead. A section in an included file ends where that file ends, so do not add the including file's \end{document} to content. content replaces the whole body as get_section_content returns it, including nested subsections and, for the last section, \end{document}, so read it first and keep what should survive. The write is made as by write_file: on a ShareJS (legacy editor) document, content that adds an emoji or other character outside the Basic Multilingual Plane, or reorders existing ones, is refused with INVALID_ARGUMENT; a timeout, a lost socket, or an Overleaf error after sending is observed, never resent; a review-only collaborator can write only with writeMode tracked and a read-only one cannot write, either being PERMISSION_DENIED before anything is sent; and a tracked write Overleaf applied without recording it as tracked changes by this account is PROTOCOL_UNSUPPORTED with details.kind applied_untracked, live and not reverted.
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>",
"revision": "<revision>",
"sectionId": "<sectionId>",
"content": "<content>"
},
"name": "write_section"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| filePath | Yes | Project-relative path using forward slashes | |
| revision | Yes | Opaque revision returned by a prior read or write | |
| projectId | Yes | Overleaf project ID | |
| sectionId | Yes | ||
| writeMode | No | Use tracked to record inserted and deleted text as Overleaf tracked changes; defaults to untracked | untracked |
| followIncludes | No | Follow \input, \include, \subfile, and \import directives from filePath down, as get_full_document does; defaults to false, one file only |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | No | ||
| protocol | Yes | ||
| revision | Yes | ||
| writeMode | Yes | ||
| trackChangesActive | Yes | ||
| recoveredAfterTimeout | No |