Table of Contents
get_tocRetrieve a heading outline for a note or folder subtree. Supports max level and limits on notes returned.
Instructions
Heading outline for a single note or a whole folder subtree.
If 'path' ends in '.md' it is a note: returns a flat ordered list of {heading, level} (the title as a synthetic H1). Otherwise 'path' is a folder: returns {path, notes, truncated} where 'notes' is an ordered list of {path, title, headings} aggregating every note under the subtree. Mirrors the 'toc://vault/{path}' resource, adding the max_level / max_notes controls below.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Note path ("a/b.md") or folder prefix ("a/b"). | |
| max_level | No | Drop headings deeper than this level (e.g. 2 keeps H1-H2); must be >= 1. The synthetic H1 title always survives. Default None returns all levels. | |
| max_notes | No | Folder mode only — cap on distinct notes (default 200, must be >= 1). When more notes match, the first max_notes (by path) are returned and 'truncated' is True. | |
| wait_for_pending_writes | No | When True, wait until recent write/edit/delete/rename operations are applied to the index before answering. Default False answers from the current index; inspect '_meta.index_stale' to tell whether a write was still in flight. Bounded by a server timeout (default 60s). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |