Skip to main content
Glama

inspect_build

Read-only

Map PDF positions to source lines and back via SyncTeX, or count words with texcount, without reading text. Use it to trace where compiled output comes from.

Instructions

Map between a build's PDF and its source with SyncTeX, or count words, without reading any text. source_to_pdf takes filePath, a 1-based line, and an optional column, and returns positions where that line lands: { page, h, v, width, height }, in PDF points (1/72 inch) from the page's top-left corner, v at the box's baseline. SyncTeX answers for a line with no output of its own, such as a comment, with the nearest output. pdf_to_source takes a 1-based page and a point h, v measured the same way, and returns locations { filePath, line, column } of the source that produced it. Both read the build buildRef names, from compile_project in this process or another, or else the latest build of this project in this process (NO_BUILD when there is none); a build Overleaf no longer keeps is BUILD_NOT_FOUND: compile again. word_count runs texcount over the current sources from filePath, or the project's root document, through its includes, with no compile and no build needed, and returns rootFilePath and wordCount: textWords, headWords (in headings), outsideWords (in captions and other text outside the body), totalWords (their sum, as texcount sums them), headers, floats, mathInline, mathDisplay, and errors (texcount's parse errors). An answer in an unknown shape is PROTOCOL_UNSUPPORTED.

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>",
      "action": "<action>"
    },
    "name": "inspect_build"
  }
}

Input Schema

NameRequiredDescriptionDefault
hNopdf_to_source: points from the left edge
vNopdf_to_source: points from the top edge
lineNosource_to_pdf: 1-based line
pageNopdf_to_source: 1-based page
actionYes
columnNosource_to_pdf: column on the line; default 0
buildRefNoThe build to read, from compile_project; defaults to the latest one
filePathNosource_to_pdf: the source file; word_count: the document to count from, the root by default
projectIdYesOverleaf project ID

Output Schema

NameRequiredDescriptionDefault
actionYes
buildIdNo
locationsNo
positionsNo
wordCountNo
rootFilePathNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.4.1

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true, but the description adds substantial behavior beyond that: build resolution rules (named buildRef, else latest build in this process), NO_BUILD and BUILD_NOT_FOUND and PROTOCOL_UNSUPPORTED error semantics, and the SyncTeX fallback where a line with no output 'such as a comment' answers with the nearest output. That is exactly the kind of failure-mode and side-effect context an agent needs before invoking.

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 purpose is front-loaded and the following sentences are organized action by action with no filler. It is a dense single block, though, and splitting the three actions or the error cases into separate sentences/list items would make scanning easier without losing content.

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?

For a nine-parameter, three-mode tool with conditional inputs, the description covers defaults, coordinate conventions, return field shapes, and error codes, and the existing output schema removes the need to explain returns further. Nothing essential for a correct first call appears to be missing.

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 high (89%), so the schema already carries most parameter meaning, but the description still adds value: it ties each parameter to its action (h/v 'measured the same way' as the returned page coordinates, filePath as the count root defaulting to the root document) and clarifies that line/column are 1-based and optional. Marginal but genuine gains over the schema.

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 names three concrete operations (SyncTeX source_to_pdf and pdf_to_source mapping, plus word_count via texcount) over a specific resource, a build's PDF and its source. It also differentiates itself from text-reading siblings with the phrase 'without reading any text', and ties buildRef back to compile_project, so an agent can place the tool in the workflow 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 Guidelines4/5

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

Usage context is explicit for each action: word_count 'runs texcount over the current sources ... with no compile and no build needed', while the mapping actions require a build from compile_project, with the directive 'compile again' on BUILD_NOT_FOUND. What's missing is any explicit statement of when NOT to use it, e.g. which sibling to use for full text retrieval instead of word counting.

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