doc_index
doc_index parses a document file — Markdown, CSV, YAML, JSON, plain text — and breaks it into sections stored as graph nodes. After indexing, use doc_toc, doc_get, and doc_query to read it efficiently without loading the entire file.
doc_index(path="docs/ARCHITECTURE.md")doc_index(path="/abs/path/to/spec.yaml")doc_index(path="data.csv", project_root="/home/user/myproject")Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | required | Path to the file to index (absolute or relative) |
project_root | string | — | Override the project root for relative path resolution |
Supported formats
Section titled “Supported formats”.md, .markdown, .csv, .txt, .rst, .toml, .yaml, .yml, .json
Code files (.ts, .rs, .py, etc.) are handled by the code graph — use code_get for those.
doc_id naming
Section titled “doc_id naming”After indexing, the file is referenced by a doc_id derived from its path with non-alphanumeric characters replaced by _:
| Path | doc_id |
|---|---|
docs/ARCHITECTURE.md | docs_ARCHITECTURE_md |
/abs/path/to/spec.yaml | abs_path_to_spec_yaml |
data.csv | data_csv |
Standard workflow
Section titled “Standard workflow”# 1. Index oncedoc_index(path="docs/ARCHITECTURE.md")
# 2. See structuredoc_toc(doc_id="docs_ARCHITECTURE_md")
# 3. Fetch a section (~200 tokens)doc_get(doc_id="docs_ARCHITECTURE_md", section="Authentication")
# 4. Search across all chunksdoc_query(doc_id="docs_ARCHITECTURE_md", keyword="rate limit")Re-run doc_index to refresh after the source file changes.