extract-document-index
Extract text from chapter documents into a JSON index for later question answering or quiz generation. Supports images, PDF, Word, and text, and skips already indexed files.
Instructions
Extracts text from documents in chapter subfolders and saves the index to output/{name}/document-index.json. Supported formats: .png .jpg .jpeg .bmp .tiff .webp — .pdf — .docx .doc — .txt .md .csv. For images: uses Tesseract OCR with Sharp preprocessing (local, offline). For PDF (native text): uses pdf-parse (no binary required). For Word (.docx): uses mammoth (no binary required). For plain text (.txt, .md): reads directly. Run once before using ask-document or generate-quiz. Skips already-indexed files unless force=true.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "extract-document-index"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Identifier for this document (e.g. 'pmp', 'scrum-guide'). Used to name the index file. Derived from basePath folder name if omitted. | |
| force | No | Re-extract even if already indexed (default: false) | |
| basePath | No | Absolute path to the folder containing chapter subfolders (Chap1/, Chap2/, ...). Overrides the DOCUMENT_BASE_PATH environment variable. | |
| chapters | No | Chapters to index (default: 1-9) |