get_sections
Parses LaTeX section headings from a project file, optionally following input/include directives, and returns section offsets and IDs for reading or editing content.
Instructions
Parse LaTeX section headings. By default this reads one file only and never follows input/include directives: singleFileOnly is true and offsets are into that file. With followIncludes: true, filePath is the document to start from (usually the root document), the headings are parsed in the text get_full_document returns for it, and singleFileOnly is false: start, headingEnd, bodyStart, and end are offsets into that flattened text, and each section adds filePath (the file holding its heading), revision (that file's revision, for write_section), and spansFiles (true when text from another file, other than white space, falls inside the section, or when an include directive or a file end falls inside its heading, so write_section refuses it). A section whose heading is in an included file ends, at the latest, where that file ends: the including file's text after the directive, such as \bibliography or \end{document}, belongs to no section. The section id then names its file, as path#command:offset, so pass followIncludes: true to get_section_content and write_section with it; the two modes end a body in different places, so an id from one mode is NOT_FOUND in the other. unresolved lists the directives that could not be followed, as in get_full_document. revision is always filePath's own.
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": "get_sections"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Project-relative path using forward slashes | |
| projectId | Yes | Overleaf project ID | |
| 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 |
|---|---|---|---|
| revision | Yes | ||
| sections | Yes | ||
| unresolved | No | ||
| singleFileOnly | Yes |