Skip to content

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)
ParameterTypeDefaultDescription
doc_idstringrequiredDocument ID from doc_list()
sectionstringHeading substring to match (case-insensitive)
chunk_indexnumberDirect chunk index if you know it
ApproachTokens for one section of a 50-page doc
Read the entire file~40,000
doc_get(doc_id, section="Auth")~200
# Step 1 — index once
doc_index(path="docs/ARCHITECTURE.md")
# Step 2 — see headings
doc_toc(doc_id="docs_ARCHITECTURE_md")
# Step 3 — fetch the section you need
doc_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_index for precise targeting when heading names are ambiguous