heading
Read one heading section from a markdown file, returning only that section's content to reduce token consumption. Accepts heading text, slug, or line number as reference.
Instructions
Read ONE section of a markdown file instead of the whole file: the referenced heading plus everything under it (subsections included), stopping at the next heading of the same or higher level. ref accepts the exact heading text, its slug ("advanced-usage"), or ANY 1-based line number — a heading line from outline() or a content line from a search hit (resolves to its enclosing section, a note says so). Returns {file, heading, level, startLine, endLine, content}; on multiple matches a note says which was returned and how to pick another. The most token-frugal way to read docs — prefer it over reading whole files.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | Yes | Heading text, slug, or line number identifying the section — from outline() or a search match. | |
| file | Yes | File path. Relative paths resolve against the server's working directory; absolute paths are allowed only inside it (outside is rejected — call info to see the root). Code: .ts .tsx .mts .cts .js .jsx .mjs .cjs .py; docs: .md .markdown .mdx |