inspect_build
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
| Name | Required | Description | Default |
|---|---|---|---|
| h | No | pdf_to_source: points from the left edge | |
| v | No | pdf_to_source: points from the top edge | |
| line | No | source_to_pdf: 1-based line | |
| page | No | pdf_to_source: 1-based page | |
| action | Yes | ||
| column | No | source_to_pdf: column on the line; default 0 | |
| buildRef | No | The build to read, from compile_project; defaults to the latest one | |
| filePath | No | source_to_pdf: the source file; word_count: the document to count from, the root by default | |
| projectId | Yes | Overleaf project ID |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| buildId | No | ||
| locations | No | ||
| positions | No | ||
| wordCount | No | ||
| rootFilePath | No |