Skip to main content
Glama

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

NameRequiredDescriptionDefault
nameNoIdentifier for this document (e.g. 'pmp', 'scrum-guide'). Used to name the index file. Derived from basePath folder name if omitted.
forceNoRe-extract even if already indexed (default: false)
basePathNoAbsolute path to the folder containing chapter subfolders (Chap1/, Chap2/, ...). Overrides the DOCUMENT_BASE_PATH environment variable.
chaptersNoChapters to index (default: 1-9)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full disclosure burden and does substantial work: it names the output path, the per-format extraction backend, notes that OCR is local/offline and that PDF/Word paths need no external binary, and describes idempotent skipping. It does not cover failure behavior, overwrite semantics for an existing index file, or what the call returns on completion.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and output location are front-loaded, followed by a compact format list and short per-format backend notes, then the prerequisite call-out. The per-format library details are dense but each earns its place by telling the agent what is supported and that no external binaries are needed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a four-parameter tool with no annotations and no output schema, the description covers the important ground: what is supported, where output lands, offline behavior, idempotency, and when in a workflow to call it. The main remaining gap is the shape of the immediate return value, which the description only implies via the output file path.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so all four parameters are already documented in the input schema; the description's 'unless force=true' restates the schema's default-false semantics with a little extra context about skipped files. Nothing is said about 'name', 'basePath', or 'chapters' beyond what the schema provides, so baseline 3 is correct.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb and resource ('Extracts text from documents in chapter subfolders') and states the exact artifact produced ('saves the index to output/{name}/document-index.json'). It is also clearly distinguishable from siblings by positioning itself as the prerequisite step for ask-document and generate-quiz.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit sequencing guidance ('Run once before using ask-document or generate-quiz') and states the skip/rerun condition ('Skips already-indexed files unless force=true'), which tells the agent when a rerun is unnecessary. What is missing is any exclusion guidance, e.g. what to do if a format is unsupported or a path is invalid.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.