Section Anything

v0.1.0
io.github.Omniwot/section-anything Checked 1 day ago Published 1 month ago

A PDF's real sections for agents: heading tree, pages and section text.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

outline_pdf

The outline of a PDF in the fewest tokens: one line per section, "index: heading (pages)", with the heading as Markdown ('#' the document title, '##' a top-level section, '###' its subsections, ...). Call this first, then read_sections with the indexes of the sections you need. section_pdf gives the same sections as full JSON (parents, heading paths, character spans) at about five times the tokens. path, mode, model, max_usd: as for section_pdf. The first line names the mode that ran: use the same mode in read_sections so the indexes match (resu…

ParameterTypeDescription
path *string
max_usd
modestring
model

section_pdf

The full heading tree of a PDF as JSON: each heading's number, title, level (1 = top), pages, parent (index of the enclosing section), heading_path, character span and confidence. No section text: use read_sections for that. For a first look at a document, outline_pdf lists the same sections at about a fifth of the tokens. path: absolute path to a PDF with a text layer (scanned PDFs need OCR first). mode: "free" (default; rules, PDF bookmarks and printed contents; no model, $0), "quick" (a small model reviews candidate headings), "standard" (a m…

ParameterTypeDescription
path *string
max_usd
modestring
model

read_sections

Read the text of chosen sections of a PDF. Each section's text runs from its heading to the next heading of any level (a parent's text does not include its subsections), reflowed into paragraphs, with running headers and footers removed. path, mode, model, max_usd: as for outline_pdf and section_pdf; use the same values so the indexes match (results are cached, so this does not run the PDF again). indexes: the section indexes outline_pdf lists (positions in section_pdf's `sections`), at most 50 per call. max_chars: cut each section's tex…

ParameterTypeDescription
indexes *array
path *string
max_charsinteger
max_usd
modestring
model
referencedinteger
referenced_max_charsinteger

estimate_cost

Estimate what each mode would cost on a PDF, without calling a model: model calls, tokens and US dollars at the configured models' list prices. free is always $0. A mode with `over_cap` true would be downgraded at this cap.

ParameterTypeDescription
path *string
max_usd