Repository navigation
v0.9.0
Multi-file documents. A manuscript split across \input, \include, \subfile, and \import
can be read as one flattened document with a source map back to every file, and the section tools
can list, read, and replace sections across those files, each write going through the
revision-checked write of the one file that holds the section. The server registers 34 tools, one
more than 0.8.x. Planned in
ROADMAP.md.
Added
get_full_document, read-only: flattens a document latexpand-style fromrootFilePath, or
from the project's root document, following\input,\include,\subfile,\import,
\subimport,\inputfrom,\subinputfrom,\includefrom, and\subincludefromup to
maxDepthlevels (default 10, at most 32). Directives in%comments and verbatim text are
skipped. A path resolves relative to the project root, then to the including file's folder (the
other way round for\subimportand its relatives);\inputtries the name and then.tex,
\includealways means.texand honours\includeonly, and\subfiletakes in only the
file's document body, up to its first\end{document}. ReturnsrootFilePath,text,files,
includeOnlywhen set, asourceMapof{ flattenedStart, flattenedEnd, filePath, docId, originalStart, originalEnd, revision }runs, andunresolveddirectives{ file, line, target, reason }, wherereasonismissing,binary_file,macro_argument(braced or not, as in
\input\chapterfileon one line;\inputused as a token, as in\let\oldinput\input, includes
nothing), orexcluded_by_includeonly. A directive that cannot be followed stays in the text as
written instead of failing the call. The text joins each file to what follows its directive with
nothing in between, exactly as the files hold it. Each file is read through the same read as
read_file, so eachrevisionroutes an edit back throughwrite_fileorwrite_section.followIncludesonget_sections,get_section_content, andwrite_section, default
false. With it,filePathis the document to start from and the headings of every included
file are listed in reading order. Each section addsfilePath(the file holding its heading),
revision(that file's), andspansFiles, its offsets are into the flattened text, and itsid
names the file, aspath#command:offset; an id from one mode isNOT_FOUNDin the other, since
the two modes end a body in different places.get_sectionsalso returnsunresolved. A section
whose heading is in an included file ends at the latest where that file ends, and the including
file's text after the directive belongs to no section. Comments and verbatim text are read file
by file, as TeX reads them, so a%comment on the last line of an included file never hides a
heading after the directive.write_sectionreplaces the body in that one file and returns its
filePath; it checks the revision against that file before looking the section up, so a file
changed since listing isREVISION_CONFLICT(details.filePath,details.liveRevision) with
nothing sent, and it refuses a section withspansFiles: truewithINVALID_ARGUMENT,
details.kind: "spans_files"anddetails.files, before anything is sent. White space alone
from another file, such as the line break after an\inputline, does not make a section span
files; an include directive inside a heading, or a file that ends inside one, does.INCLUDE_CYCLE(details.chain) andINCLUDE_DEPTH_EXCEEDED(details.maxDepth,
details.chain) error codes, fromget_full_documentand the section tools with
followIncludes: true. The command line exits 1 for both. A flattened text longer than 8,388,608
UTF-16 code units isDOC_TOO_LARGEwithdetails.kind: "flattened", and include directives
that take in files more than 10,000 times in all, counting a file once per inclusion, are
DOC_TOO_LARGEwithdetails.kind: "includes", so an include graph that fans out cannot exhaust
the server's time or memory.- On the command line,
overleaf-web-mcp call get_full_documentandoverleaf-web-mcp schema get_full_document, and in the SDK,client.getFullDocument.
Changed
get_sectionsresult:singleFileOnlyis now a boolean,trueas before unless
followIncludes: trueis passed, andsectionsitems andget_section_content'ssectionmay
carry the three fields above. A call withoutfollowIncludesreturns exactly what it returned in
0.8.x.write_sectionresult may carryfilePath, set whenfollowIncludes: truewas passed.write_sectionchecks theoverleaf-writeeffect of the access policy before it reads the
document, with or withoutfollowIncludes. Under a policy withoutoverleaf-write, 0.8.x
joined the project and read the document before refusing the write withPOLICY_DENIED; now
nothing is sent. The error is the same.- A section id passed to
get_section_contentorwrite_sectionthat is not found now says how to
list the sections again, and, for an id that names a file, thatfollowIncludes: trueis needed.
The code is stillNOT_FOUND.
Documentation
- The tool reference documents the directives followed, how paths resolve, the
unresolved
reasons, and the source map; the user guide, safety model, and command line guide list the new
tool and error codes. - The three Agent Skills, and the command line page's examples, run
npx --yes overleaf-web-mcp@0.9, pinned to this minor version as they were pinned to 0.8. The
overleaf-revise-manuscriptskill gains "Sections across included files", which works by
section across a manuscript split with\inputor\includethroughfollowIncludes.