Skip to main content
Glama

get_sections

Read-only

Parses LaTeX section headings from a project file, optionally following input/include directives, and returns section offsets and IDs for reading or editing content.

Instructions

Parse LaTeX section headings. By default this reads one file only and never follows input/include directives: singleFileOnly is true and offsets are into that file. With followIncludes: true, filePath is the document to start from (usually the root document), the headings are parsed in the text get_full_document returns for it, and singleFileOnly is false: start, headingEnd, bodyStart, and end are offsets into that flattened text, and each section adds filePath (the file holding its heading), revision (that file's revision, for write_section), and spansFiles (true when text from another file, other than white space, falls inside the section, or when an include directive or a file end falls inside its heading, so write_section refuses it). A section whose heading is in an included file ends, at the latest, where that file ends: the including file's text after the directive, such as \bibliography or \end{document}, belongs to no section. The section id then names its file, as path#command:offset, so pass followIncludes: true to get_section_content and write_section with it; the two modes end a body in different places, so an id from one mode is NOT_FOUND in the other. unresolved lists the directives that could not be followed, as in get_full_document. revision is always filePath's own.

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>",
      "filePath": "<filePath>"
    },
    "name": "get_sections"
  }
}

Input Schema

NameRequiredDescriptionDefault
filePathYesProject-relative path using forward slashes
projectIdYesOverleaf project ID
followIncludesNoFollow \input, \include, \subfile, and \import directives from filePath down, as get_full_document does; defaults to false, one file only

Output Schema

NameRequiredDescriptionDefault
revisionYes
sectionsYes
unresolvedNo
singleFileOnlyYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.0

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; the description adds substantial behavior beyond that: offsets are relative to the flattened text under followIncludes, spansFiles marks sections that write_section will refuse, ids from one mode are NOT_FOUND in the other, unresolved lists unfollowable directives, and text after an include directive belongs to no section.

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?

Front-loaded with the core purpose and free of filler sentences, but the followIncludes explanation is one very long run-on with stacked parentheticals, which makes the dense offset and id rules harder to scan than a short list would 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?

For a dual-mode parser with an output schema, the description covers everything an agent needs: default versus followIncludes behavior, offset bases, per-section fields, cross-mode id compatibility, and the unresolved list. Nothing material is left ambiguous.

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 baseline is 3, but the description adds real meaning: filePath becomes the document to start from when followIncludes is true, and followIncludes alters what every offset and id means. It does not explain the projectId parameter, but that is already documented in 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?

Opens with a specific verb+resource: 'Parse LaTeX section headings.' The remainder distinguishes it precisely from get_section_content and write_section by contrasting the two parse modes and their id spaces, so an agent can tell the tools apart without opening schemas.

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?

Gives explicit mode-selection guidance: default is one file only, and 'pass followIncludes: true to get_section_content and write_section with it' names the downstream tools and the required matching flag. It never states when to prefer get_full_document or read_file over this tool, so guidance is strong but not exhaustive.

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