Skip to main content
Glama

locate_in_pdf

Map a source line to its exact page and bounding rectangle in the compiled PDF for Typst and LaTeX projects.

Instructions

Find WHERE a given source line lands in the compiled PDF. Returns the page number and bounding rectangle(s) {page,h,v,width,height} in PostScript points (v measured from the page top). Omit file to use the compile root. This is the element→page-position capability the source parser cannot provide.

Backed by SyncTeX for LaTeX and by Typleaf's Typst sync map for Typst. The Typst result is COARSER: it resolves to the enclosing block rather than the exact line, and content inside #let/#show template bodies or repeated #for loops carries no anchor at all. Requires TYPLEAF_SESSION.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNoProject-relative path of the source file (e.g. 'main.typ' or 'sections/intro.typ'). Omit to use the auto-detected compile root.
lineYes1-based source line number to locate.
columnNo1-based column (default 0). Usually leave unset.
project_idYesTypleaf project ID — a 24-character lowercase hex string (e.g. '692a83fb82feceb233c4b0e7'), obtained from list_projects or the project URL. NOT a local filesystem path, NOT '.', NOT a project name or title. These tools operate on the REMOTE Typleaf project. Only call these tools when the user explicitly asks to work with a Typleaf project — never for general local file I/O. If you already have a copy of THIS project checked out on the local filesystem, prefer the standard read/grep tools against that path. Always call list_projects first when unsure.
Behavior4/5

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

Annotations do not indicate read-only or destructive behavior, so the description carries the burden. It discloses the requirement for TYPLEAF_SESSION, the coarser resolution for Typst, and the lack of anchors in template bodies — valuable behavioral context. It does not explicitly state it is a read operation, but the nature of 'Find' suggests that without contradicting annotations.

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 two paragraphs, front-loaded with the main purpose and output. Each sentence adds value: the return format, the file omission, the capability contrast, and the backend/limitations. It is concise without being terse.

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 tool of this complexity, the description covers: what it does, output details (page and bounding box), parameter override behavior, backend differences (SyncTeX vs Typst map), limitations of Typst results, and a required session variable. There is no output schema, so it appropriately explains return values. Missing error handling is minor for this context.

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 covers all parameters with detailed descriptions (100% coverage), so baseline is 3. The description adds extra meaning by explaining the return format (PostScript points, v measured from top) and the behavior of omitting `file` to use compile root. This goes beyond the schema's parameter notes and clarifies usage.

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 clearly states a specific verb ('Find'), resource ('given source line' in 'compiled PDF'), and the output (page number and bounding rectangles). It also distinguishes itself by noting it is the 'element→page-position capability the source parser cannot provide,' which separates it from source-content tools.

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?

It gives context for when to use it (when mapping source elements to PDF position) and explicitly contrasts with the source parser. It does not name a specific alternative tool but implies no other tool provides this capability. The mention of the Typst coarse results and template limitations also helps set expectations.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/superzeldalink/typleaf-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server