Skip to main content
Glama

Metis · Librarian — Index Library Pdfs

index_library_pdfs

Builds or rebuilds a PaperQA2 index over PDFs in your library so queries can run without re-reading every document. Use it after adding papers or when forcing a full reindex.

Instructions

Build or rebuild a PaperQA2 index over the user's PDF library.

Walks knowledge/library/ (all subdirectories), collects PDFs, and indexes
them with PaperQA2 + Claude Haiku. The index is persisted so that
ask_library() can query it without re-reading every PDF.

Run once after adding new papers, or with force_reindex=True to rebuild.

Args:
    force_reindex: Rebuild from scratch even if an index already exists.
    topic_filter: If given, only index PDFs whose parent folder name
                  contains this string (e.g. "Malaria", "Epidemiology", "Methods").
    scope: Which library to index. "default" = knowledge/library/ (all PDFs).
           "ph_library" = knowledge/library/ph-background/ (public health background).

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": "index_library_pdfs"
  }
}

Input Schema

NameRequiredDescriptionDefault
scopeNodefault
topic_filterNo
force_reindexNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior3/5

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

With no annotations, the description carries the full burden: it discloses that it recurses all subdirectories, that the index is persisted, and that force_reindex rebuilds from scratch. It omits the operationally important traits of a full-library LLM indexing job — expected duration, token/API cost, whether an existing index is overwritten without force_reindex, and failure behavior — which matter a lot before an agent kicks this off.

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?

The purpose and the persistence/ask_library link are front-loaded, then usage trigger, then Args — a sensible reading order with little waste. It is slightly longer than needed for three optional parameters, but no sentence is filler.

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?

An output schema exists, so return values need no explanation, and the description covers directory scope, engine, persistence, and all three parameters. What's missing for a heavyweight mutation/indexing tool with zero annotations is the cost/time and idempotency story, the only real gap.

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

Parameters5/5

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

Schema coverage is 0% and scope has no enum, so the Args section is the only documentation — and it fully delivers: force_reindex's exact semantics, topic_filter's matching rule (parent folder name contains the string) with examples, and scope's allowed values with the directory each maps to. This is exactly the compensation the schema gap requires.

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

Purpose4/5

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

The first sentence gives a specific verb+resource (build/rebuild a PaperQA2 index over the PDF library) and the body names the concrete directory and embedding stack. It does not, however, distinguish itself from similarly-named siblings such as index_pdf_library or build_pdf_knowledge_db, so an agent still has to guess which indexing tool is the right one.

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?

"Run once after adding new papers, or with force_reindex=True to rebuild" gives a clear trigger condition, and the description points at ask_library() as the read-side counterpart. It stops short of saying when NOT to use it (e.g. vs. index_pdf_library or scan_library), so the routing is helpful but incomplete.

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

Deploy Server

Other Tools