Skip to main content
Glama

Compile the project

compile_project
Read-only

Compile an Overleaf project locally or on Overleaf and report errors and warnings, helping catch broken papers before collaborators see them.

Instructions

Compile one project and report the errors and warnings, so a broken paper is caught before collaborators see it; where picks the compiler. Call it after editing and before push_changes. local, the default, runs latexmk -pdf on this computer. It compiles the clone as it stands, local edits included, without pulling, and halts at the first error. Without mainTexFile it tries main.tex, paper.tex, manuscript.tex, root.tex, thesis.tex and article.tex at the root, then the shallowest .tex file, and stops with a message if that file has no \begin{document}. Build artifacts go to a directory outside the clone, so they are never pushed, and the reply gives the path of the PDF there when the compile produced one, with the SyncTeX map beside it (latexmk runs with -synctex=1). Without latexmk and a TeX distribution installed locally it says so instead of compiling; a run past the configured timeout, 180 seconds by default, is reported as an error. It also restores any files sparse checkout was holding back, since figures must be on disk to compile. overleaf compiles on Overleaf's own servers, exactly as the Recompile button does, with the project's compiler and TeX Live version from Overleaf's settings and the account's plan deciding the time limit. It compiles what is in Overleaf now, so local edits count only after push_changes, and without mainTexFile it uses the main document set in Overleaf's menu; draft and stopOnFirstError apply to it only. Its PDF, log, output.bbl, output.blg and SyncTeX map, whichever it produced, are saved to the same build directory, replacing the previous compile's, and the reply gives each path. Returns a verdict line, then errors, then warnings, including BibTeX's and biber's for overleaf, then the output paths.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "compile_project"
  }
}

Input Schema

NameRequiredDescriptionDefault
draftNowhere overleaf only. Draft mode: faster, with images replaced by boxes (default false).
whereNoWhere to compile (default "local"): local runs latexmk on the clone, local edits included; overleaf compiles on Overleaf's servers what has been pushed.local
projectNoWhich project to use: its Overleaf address, its 24-character id, or a registered project name. Omit to use the default project.
mainTexFileNoRoot document to compile, as a path in the project, the one containing \begin{document}. Omitted, local guesses it from the project layout and says so if the guess has no document environment, and overleaf uses the main document set in Overleaf's menu.
stopOnFirstErrorNowhere overleaf only. Stop at the first LaTeX error instead of carrying on to produce a PDF (default false, as in Overleaf).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.5.3
    • addedInput schema / properties / draft
      Added value: +{
      +  "description": "where overleaf only. Draft mode: faster, with images replaced by boxes (default false).",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / mainTexFile / description
      Previous value: -"Path to the root .tex file, the one containing \\begin{document}. Omitted, the server guesses it from the project layout and says so if the guess has no document environment."New value: +"Root document to compile, as a path in the project, the one containing \\begin{document}. Omitted, local guesses it from the project layout and says so if the guess has no document environment, and overleaf uses the main document set in Overleaf's menu."
    • addedInput schema / properties / stopOnFirstError
      Added value: +{
      +  "description": "where overleaf only. Stop at the first LaTeX error instead of carrying on to produce a PDF (default false, as in Overleaf).",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / where
      Added value: +{
      +  "default": "local",
      +  "description": "Where to compile (default \"local\"): local runs latexmk on the clone, local edits included; overleaf compiles on Overleaf's servers what has been pushed.",
      +  "enum": [
      +    "local",
      +    "overleaf"
      +  ],
      +  "type": "string"
      +}
  2. First observedv0.3.8

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnly and openWorld annotations, it discloses many operational behaviors: no pulling, halting at the first local error, build artifacts outside the clone, sparse-checkout restoration, missing-latexmk handling, and the 180-second timeout. It also explains that overleaf compilation uses Overleaf's servers, settings, and plan limits, and that draft and stopOnFirstError apply only there.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with purpose and workflow timing, and most sentences carry operational detail that an agent needs. It is a dense single paragraph, however, and repeats some local-versus-overleaf and mainTexFile behavior, which makes it harder to scan than it could be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, but the description fully explains the return format: a verdict line, errors, warnings including BibTeX and biber, and output paths. For a complex dual-mode compile tool, this covers what an agent needs to call it and interpret the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents each parameter. The description still adds useful meaning by listing the exact local main-file candidates, explaining the no-document-environment failure, and clarifying that draft and stopOnFirstError are overleaf-only, though much of this overlaps with the schema text.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: compile one project and report errors and warnings. It distinguishes local from overleaf compilation and explicitly names the sibling workflow context with push_changes, so an agent can identify its role without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit timing guidance: call it after editing and before push_changes. It also explains how to choose between local and overleaf modes, including the default and the consequence that local edits only reach overleaf after push_changes.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.