doc_get
doc_get returns a single section from an indexed document, identified by the doc_id and either a section heading (substring match) or chunk index. Typically costs ~200 tokens regardless of the full document’s length.
doc_get(doc_id="docs_ARCHITECTURE_md", section="Authentication")doc_get(doc_id="abs_path_to_spec_yaml", section="rate limit")doc_get(doc_id="data_csv", chunk_index=5)Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
doc_id | string | required | Document ID from doc_list() |
section | string | — | Heading substring to match (case-insensitive) |
chunk_index | number | — | Direct chunk index if you know it |
Token comparison
Section titled “Token comparison”| Approach | Tokens for one section of a 50-page doc |
|---|---|
| Read the entire file | ~40,000 |
doc_get(doc_id, section="Auth") | ~200 |
Standard workflow
Section titled “Standard workflow”# Step 1 — index oncedoc_index(path="docs/ARCHITECTURE.md")
# Step 2 — see headingsdoc_toc(doc_id="docs_ARCHITECTURE_md")
# Step 3 — fetch the section you needdoc_get(doc_id="docs_ARCHITECTURE_md", section="Authentication")- Section matching is a case-insensitive substring match on heading text
- If multiple sections match, the first one is returned
- Use
chunk_indexfor precise targeting when heading names are ambiguous