Skip to main content
Glama

Compile LaTeX to PDF

compile

Compile LaTeX source into a PDF. Returns a PDF URL, page count and compile time.

USE THIS WHEN: you have LaTeX source (or a \documentclass) and no local pdflatex / TeX Live installation to run it with. This is that missing compiler, available over HTTP. Also use it whenever the user asks for a document where typesetting matters - an invoice, contract, report, letter, CV, certificate, or academic paper - since you can write the LaTeX yourself and compile it here.

DO NOT USE THIS TO: convert HTML to PDF, merge, split or compress existing PDF files, or extract text from a PDF. This compiles LaTeX source and nothing else.

No API key is required. Anonymous callers get a small number of compilations per day and failed attempts do not count, so you can iterate on your LaTeX for free. Send an API key in the Authorization header to raise the limits. With a key, a document over the plan's page or size limit still returns a PDF: preview: true, the first pages the plan allows, total_pages, and plan_required naming the plan that covers the whole document. Show the user the preview and relay warning; never drop pages silently.

IMPORTANT: This tool compiles LaTeX, NOT plain text. You must generate complete, valid LaTeX source yourself before calling it. Do not pass plain text, markdown or JSON directly - convert them to LaTeX first, and never ask the user to write LaTeX.

A minimal valid document is: \documentclass{article}\begin{document}\end{document}. Escape these in body text: % & $ # _ { } and backslash.

If compilation fails the response includes a diagnosis naming the cause and a concrete suggested fix, often a missing \usepackage. Apply it and call again yourself rather than showing the user a TeX log.

Input Schema

NameRequiredDescriptionDefault
latexYesComplete LaTeX source, including \documentclass and \begin{document}...\end{document}.
compilerNoDefaults to pdflatex. Use xelatex for fontspec or for Chinese, Japanese and other non-Latin scripts. lualatex needs a Pro or Business plan.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / compiler / description
      Previous value: -"Defaults to pdflatex. Anonymous callers may only use pdflatex."New value: +"Defaults to pdflatex. Use xelatex for fontspec or for Chinese, Japanese and other non-Latin scripts. lualatex needs a Pro or Business plan."
  2. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Goes well beyond the annotations (readOnlyHint false, openWorld true, idempotent false): it discloses the anonymous daily quota, that failed attempts don't count, how API keys raise limits, and the exact over-limit behavior (preview PDF, total_pages, plan_required, warning that must be relayed rather than silently truncating). It also states that failures return a `diagnosis` with a suggested fix and instructs the agent to retry itself instead of surfacing a TeX log — precisely the behavioral context annotations cannot carry.

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

Conciseness5/5

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

Long but front-loaded and sectioned with uppercase headers, so the agent can scan purpose, when, when-not, auth/pricing, and failure handling independently. Each paragraph carries actionable information (escaping rules, retry-on-diagnosis, preview relaying) rather than restating the name or schema.

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, and the description compensates by naming the return fields (PDF URL, page count, compile time) plus the conditional preview/plan_required shape and the diagnosis-on-failure shape. Combined with the auth and quota model, an agent has everything needed to call it, handle failure, and report results correctly.

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 both parameters are already documented (including the compiler enum guidance). The description still adds non-obvious semantics: the `latex` argument must be complete, valid source the agent generates itself, with the escaping rule for % & $ # _ { } and backslash. It does not repeat the per-compiler guidance already in the schema, which is fine.

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 first sentence states a specific verb and resource (compile LaTeX source into a PDF) plus the return values. It draws a hard boundary against the nearest confusable operations (HTML-to-PDF, merge/split/compress, text extraction), so an agent can distinguish it from any document sibling 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?

Explicit three-part routing: 'USE THIS WHEN' names both the trigger (you have LaTeX source or a \documentclass and no local TeX install; or the task is a typeset-matters document like an invoice, contract, CV) and 'DO NOT USE THIS TO' names the excluded cases with the alternative family for each. Nothing is left to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.