Skip to main content
Glama

Build the semantic search index

zotero_index
Destructive

Manage the local hybrid-search index for your Zotero library: build, update, refresh, and monitor background jobs to keep semantic search current.

Instructions

Manage the local hybrid-search index used by zotero_semantic_search. Every job runs in the background on the server, so this tool returns immediately and never blocks on large libraries. THREE write actions, and picking the right one matters: action: "update" is the cheap one and should be the default for a library that is already indexed; action: "build" and action: "refresh" both rebuild the WHOLE index, which on a large library means many minutes and, with an API embedding provider, real spend (they differ in one thing: build resumes an interrupted build, refresh always starts over). action: "build"/"refresh" pages the library's top-level items (100-at-a-time, stopping at the server's item cap, ZOTEUS_INDEX_MAX_ITEMS, default 5000, or at a smaller limit if one is given), indexes their text (title, abstract, creators, tags) for BM25 keyword search and, if an embedding provider is configured, for vector search, persisting partial progress atomically as it goes; use it for the first build, after changing the embedding model, or to widen a previously capped build. It is ALSO the repair: if the index cannot be read at all, only action:"build" clears it, by deleting the unreadable file and opening a fresh one before rebuilding (nothing repairs it at startup or inside a query). action: "update" instead fetches only the items changed since the version the index recorded (Zotero's ?since=), re-chunks and re-embeds just those, and removes items the library no longer holds (diffed from a cheap keys-only ?format=versions census, since the deletion log is cloud-only); untouched items are never re-embedded, so adding a handful of items costs seconds instead of a full rebuild. Update falls back to a full rebuild by itself, and says so in updateNotice, when a delta would be wrong: no version stamp recorded yet, the library is now served by a different Zotero API (the desktop app and the cloud number their versions independently), or the embedding model changed. An update ALSO asks Zotero's full-text index what it has extracted since the build (that is a separate version sequence from item versions, so a PDF Zotero extracted when it was first opened changes no item version and appears in no delta) and indexes the new body text for items nothing else touched; on a library where nothing was extracted, that costs one request. A build or update interrupted by action:"stop", a crash or a restart leaves a checkpoint, and action: "build" RESUMES from it: the items already committed stay searchable and are never re-fetched or re-embedded, and only work since the last save is redone (resumedFrom on the status reports how many were inherited). action: "refresh" is the one that always starts over. A build also indexes the reader's OWN words by default: every child note, and every PDF annotation (its highlighted passage and its comment), as extra passages carrying the parent item's key — so zotero_annotate writes text that search can then find, an item with forty annotations still takes one result slot, and a hit whose snippet came from one is marked source:"note" or source:"annotation". That corpus is one paged crawl of hand-written text, orders of magnitude smaller than attachment bodies; turn it off with own_words:false or ZOTEUS_INDEX_OWN_WORDS=false. An action:"update" keeps it current for the cost of one request when nothing was written: notes and annotations are ordinary items carrying ordinary versions, so an edit, an addition and a deletion are all found by comparing the library's note/annotation keys against the ones the index holds — which is also how an index built before this existed fills its gap, once, on its first update. Set fulltext:true to ALSO index the body text Zotero extracted from each item's attachments, which is what makes semantic search match a claim buried in a PDF rather than only its title and abstract; it is off by default because it multiplies build time and index size (default cap: 40000 characters per item, tunable with fulltext_max_chars), and only attachments Zotero has already extracted are available. That pass used to be refused inside Claude Desktop, where a build that reached it killed the server process partway through with no error at all (#37); the cause was the on-device embedding model asking Electron's allocator for a block it will not serve, so the server now embeds fewer passages per call there and the build runs to completion. It is somewhat slower inside the app than in a terminal and produces exactly the same index, so a user who wants the fastest possible first build can still run one headlessly against the same ZOTEUS_DATA_DIR and let Desktop read the result. A build runs in TWO passes and reports which one it is on as phase: every item's metadata is indexed first, across the whole library, and only then are attachment bodies crawled (fulltextItemsScanned of fulltextItemsTotal). So the library is fully searchable on titles, abstracts, creators and tags long before a full-text crawl that can run for hours finishes — tell the user they can search already rather than asking them to wait for state:"done". Start a job, then POLL action: "status" every few seconds until state is "done" (or "error"); calling build or update again while one is running just returns current progress. action: "status" reports state (idle|building|done|error), operation (build|update), phase (metadata|fulltext), fetch/embed progress, itemsRemoved, index size, the active embedder, libraryVersion/libraryBackend (the version stamp an update diffs from), fulltextVersion (how far into Zotero's separate full-text sequence the index has read), resumedFrom (items inherited when a build resumed an interrupted one), itemsTotal/itemsAvailable (which differ, with a warning, when the cap stopped the crawl short of the library), ownWordsItems/ownWordsPassages (the notes and annotations indexed, with ownWordsReason if they could not be read), and (when full text was requested) fulltextItems/fulltextPassages plus fulltextReason if it produced nothing. It also reports localApiDegradedAt when the job saturated Zotero's local API and the whole session fell back to the Zotero Web API: that fallback works, so nothing errors, but the Web API is slower and rate-limited and the rest of the build takes far longer than its start suggested, so tell the user rather than letting them watch an unexplained slowdown (the crawl also backs off to one attachment at a time by itself, to let the app recover). It reports where the index is stored (storage: sqlite or memory, set by ZOTEUS_INDEX_BACKEND), storageNotice when opening that store imported or refused an older JSON index, persistError when the index could not be written to disk at all, and how the last semantic query ranked vectors (vectorScan: "codes" for the two-stage path, "exact" for a full scan of every vector, with vectorScanNotice when that needs explaining). When the embedding provider is an API (ZOTEUS_EMBEDDINGS=openai or gemini), status also reports embedRate: the batch size, the pause between requests, the estimated tokens per request and the tokens per minute the build is actually sustaining, plus passagesWithoutVectors when the index holds passages nothing has embedded yet. A build whose embedder was rate-limited to a standstill keeps every passage it indexed and stays RESUMABLE: tell the user to run action:"build" again, which embeds only the passages that have no vector and re-fetches nothing, and NOT action:"refresh", which starts the whole crawl over and pays for every vector a second time. A rate-limited request already backs off and retries by itself; if a build reports it is riding the provider's tokens-per-minute limit, the fix is ZOTEUS_EMBED_BATCH_DELAY_MS (with ZOTEUS_EMBED_BATCH_SIZE), not a smaller library. action: "stop" cancels a running job (partial data is kept and stays searchable; a stopped update leaves the version stamp untouched so the next one repeats the delta, and a stopped build leaves a checkpoint the next action:"build" resumes from). stop is a one-shot cancel: the next action:"build" picks the checkpoint straight back up. action: "pause" is the durable form: it stops a running job the same way AND persists a hold that survives restarts, so build, refresh, update and zotero_semantic_search's automatic first build all refuse until action: "resume" clears it (queries keep working on what is indexed). resume clears the hold and starts nothing by itself, so follow it with build to continue a checkpoint or update for a delta; status reports paused. A partially built index is always usable for keyword search. Local embeddings are CPU-bound (see ZOTEUS_EMBEDDINGS), so large builds take a while: poll status rather than retrying build.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax items to index. Lowers the configured cap for this build only; it cannot raise it. The cap defaults to 5000 and is set by ZOTEUS_INDEX_MAX_ITEMS.
actionYes
fulltextNoAlso index the full text Zotero extracted from each item's attachments, so searches match the body of a PDF. Resource-intensive (slower build, much larger index); defaults to ZOTEUS_INDEX_FULLTEXT (off unless set).
own_wordsNoAlso index the reader's OWN words — child notes and PDF annotations (highlight text and comments) — as passages carrying the parent item's key. On by default (ZOTEUS_INDEX_OWN_WORDS); the whole corpus is one paged crawl of hand-written text, so it costs a fraction of what fulltext does.
library_idNo
library_typeNo
fulltext_max_charsNoCap on indexed full-text characters per item; 0 means no cap (default 40000). Only used with fulltext.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changedv1.16.0
    • changedInput schema / properties / action / enum
      Previous value: -[
      -  "build",
      -  "refresh",
      -  "update",
      -  "status",
      -  "stop"
      -]New value: +[
      +  "build",
      +  "refresh",
      +  "update",
      +  "status",
      +  "stop",
      +  "pause",
      +  "resume"
      +]
  2. Changed1 schema field changedv1.13.0
    • addedInput schema / properties / own_words
      Added value: +{
      +  "description": "Also index the reader's OWN words — child notes and PDF annotations (highlight text and comments) — as passages carrying the parent item's key. On by default (ZOTEUS_INDEX_OWN_WORDS); the whole corpus is one paged crawl of hand-written text, so it costs a fraction of what fulltext does.",
      +  "type": "boolean"
      +}
  3. Changed3 schema fields changedv1.7.1
    • changedInput schema / properties / action / enum
      Previous value: -[
      -  "build",
      -  "refresh",
      -  "status",
      -  "stop"
      -]New value: +[
      +  "build",
      +  "refresh",
      +  "update",
      +  "status",
      +  "stop"
      +]
    • changedInput schema / properties / limit / description
      Previous value: -"Max items to index (default 5000, which is also the hard cap)."New value: +"Max items to index. Lowers the configured cap for this build only; it cannot raise it. The cap defaults to 5000 and is set by ZOTEUS_INDEX_MAX_ITEMS."
    • removedInput schema / properties / limit / maximum
      Removed value: -5000
  4. Changed2 schema fields changedv1.6.0
    • addedInput schema / properties / fulltext
      Added value: +{
      +  "description": "Also index the full text Zotero extracted from each item's attachments, so searches match the body of a PDF. Resource-intensive (slower build, much larger index); defaults to ZOTEUS_INDEX_FULLTEXT (off unless set).",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / fulltext_max_chars
      Added value: +{
      +  "description": "Cap on indexed full-text characters per item; 0 means no cap (default 40000). Only used with fulltext.",
      +  "maximum": 1000000,
      +  "minimum": 0,
      +  "type": "integer"
      +}
  5. Changed2 schema fields changedv1.3.1
    • changedInput schema / properties / action / enum
      Previous value: -[
      -  "build",
      -  "refresh",
      -  "status"
      -]New value: +[
      +  "build",
      +  "refresh",
      +  "status",
      +  "stop"
      +]
    • addedInput schema / properties / limit
      Added value: +{
      +  "description": "Max items to index (default 5000, which is also the hard cap).",
      +  "maximum": 5000,
      +  "minimum": 1,
      +  "type": "integer"
      +}
  6. First observedv1.0.4

TDQS

A4.6/5.0
Behavior5/5

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

Despite annotations marking destructive/read-only behavior, the description goes far beyond them: it discloses background execution, atomic checkpointing, resumability, destructive clearing of unreadable index files, Web API fallback on local API saturation, rate-limit backoff, and server-crash behaviors. It also explains what survives a stop/pause and how a stopped update leaves the version stamp untouched, making the tool's side effects predictable.

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

Conciseness2/5

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

The description is far too long, repeating build/status behavior and embedding details in multiple places. It is front-loaded with a clear purpose sentence, but a large portion could be condensed or moved into structured documentation. This level of verbosity can overwhelm an agent and dilute the key action-selection guidance.

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

Completeness5/5

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

Given the tool's complexity and the absence of an output schema, the description is exceptionally complete. It documents the full status payload (state, operation, phase, embedRate, resumedFrom, itemsRemoved, localApiDegradedAt, persistError, etc.) and covers failure modes, environment variables, migration cases, and performance implications. Almost every scenario an agent could encounter is addressed.

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

Parameters4/5

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

Schema coverage is only 57%, with library_id and library_type having no description in the schema. The description compensates well for action, limit, fulltext, own_words, and fulltext_max_chars, including default values and trade-offs. However, it never explains how library_id/library_type select the target library or their allowed values, leaving a real gap for calling the tool correctly.

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 is explicit: 'Manage the local hybrid-search index used by zotero_semantic_search' immediately states the resource and role. It then enumerates all seven actions (build, refresh, update, status, stop, pause, resume) with distinct semantics, and clearly separates index management from the sibling zotero_semantic_search tool.

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

Usage Guidelines5/5

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

The description provides strong decision rules: `update` is 'the cheap one and should be the default', `build` and `refresh` are for full rebuilds with the precise distinction that build resumes and refresh always starts over. It also gives scenario-based guidance (first build, model change, capped build, repair, rate-limited embedders) and explicitly tells the agent to poll `status` rather than retry build.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/oscardvs/zoteus'

If you have feedback or need assistance with the MCP directory API, please join our Discord server