Indexing¶
embeddings_status¶
Embeddings Status. Read-only. Idempotent.
Check embedding provider and vector-index status.
Parameters
None.
Returns
Dict with the following fields:
- available (bool): True when an embedding provider is
configured, even before the first build finishes. It does not
say the embeddings are complete;
get_index_statusdoes. - provider (str | None): Provider class name when configured
(such as
"OllamaProvider"), or null if not configured. chunk_count(int): Number of chunks currently in the vector index.- path (str | None): Vector index file path when persisted in
files, or null when the vectors are held in memory, kept in a
database (see backend and
store_details), or not configured. - backend (str | None): Name of the store holding the vectors
(such as
"sqlite"), or null if no provider is configured. - identity (dict | None): The provider, model, variant, text format and dimension the stored vectors were embedded with, or null until the store is first opened.
- generation (int | None): Count of full rebuilds the store has published, or null until the store is first opened.
search_mode(str | None): "resident" when semantic search holds the vectors in memory, "streamed" when each search reads them in batches.search_workspace_bytes(int | None): Configured vector bytes one streamed batch may hold; null when resident or when the database scores the vectors itself.stored_bytes(int | None): Measured size of the store's files or database tables; null when the vectors are held in memory.resident_vector_bytes(int | None): Measured bytes of the vectors held in memory; 0 when streamed. Other memory the server uses is not counted.
The four fields above are null until the store is first opened, and when the store does not report them.
store_details(dict | None): Where a database-backed store lives, with the keyshost,port,database,schema,postgresql_version,pgvector_version,writer(this server may write) andlease_held(it holds the writer lease now). Null for a file or in-memory store, and until the store is first opened. It never shows credentials.
get_index_status¶
Index Status. Read-only.
Report FTS index readiness, progress, and last build error.
Parameters
None.
Returns
Dict with the following fields:
- status (str):
"queryable","building", or"failed". offline_changes(str): Whether files changed while no server was running have reached the index."reconciled"once a build or reindex since this server started has compared the index with every file;"reconciling"while one is queued or running;"not_reconciled"when none has, as after a start that skips the startup reindex. A scan that could not read a folder, or found the vault folder empty, does not count. Until it is"reconciled", search can miss or return stale notes for files changed outside the server; callreindexto reconcile them. Once"reconciled"it stays so; a later failure shows inerrororlast_reindex_error.documents_indexed(int): Count of documents committed to the FTS index right now (rises during"building").0both for an empty index and when the count could not be read; seedocuments_indexed_errorto tell them apart.documents_indexed_error(str | None):Noneon a normal read; the SQLite error message when the document count could not be read (such as a locked or closed database), in which casedocuments_indexedis0.- error (str | None): The message of the last background build
that failed, or
None. It can stay set while status is"queryable", until the next successful build clears it, and is alwaysNonewhile status is"building". last_reindex_error(str | None): The message of the last reindex that failed, orNoneonce a reindex succeeds.last_build_embeddings_error(str | None): The message of the last embeddings build that failed, orNoneonce one succeeds.queue_depth(int): Jobs waiting for the index writer.in_flight(str | None): The kind of job the index writer is running, such as"process_dirty_paths", orNonewhen idle.dirty_paths(int): Changed notes not yet refreshed in the index.dirty_embeddings(int): Changed notes not yet re-embedded.write_generation(int): A counter that rises each time the index writer finishes a job.skipped_files(list[dict]): Files dropped from the index for a surfaced deterministic reason. Each entry is{"path", "category", "detail"}wherecategoryis one of"parse_error","encoding_error","missing_frontmatter", or"internal_error"(an unexpected indexer error, vs a content problem). Empty when nothing was skipped. Distinguishes a parse-dropped note from an unsynced one without reading container logs. Exclude-pattern and transient-I/O skips are intentionally not listed.
The index, and the embeddings when semantic search is configured,
have caught up once status is "queryable", queue_depth is 0,
in_flight is None, and dirty_paths and dirty_embeddings are both 0.
reindex¶
Reindex Vault. Changes state, not destructive. Idempotent.
Bring the search index up to date with files changed outside this server, such as by an editor or a sync tool; returns counts of added, modified, deleted and unchanged notes.
Writes through this server's tools update the index themselves, so do not call it after them.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
force |
boolean |
false |
Drop the index and re-parse every note instead of only changed ones: slower, and search waits until it finishes. Use it when results no longer match the notes, then run build_embeddings if the vault has semantic search. Default false. |
Returns
On inline completion, a dict with "status": "completed" plus
the reindex counts:
- added (int): Documents added since the last index. On a force=True rebuild every indexed document is counted here, because the rebuild dropped and re-added them all.
- modified (int): Documents that changed since the last index (always 0 on a force=True rebuild).
- deleted (int): Documents removed since the last index (always 0 on a force=True rebuild; the drop is not a vault change).
- unchanged (int): Documents with no changes (always 0 on a force=True rebuild).
- skipped (int): Files deliberately not indexed (missing required frontmatter, exclude patterns, unparseable).
full_rebuild(bool): True when force=True re-parsed everything.
When promoted, a dict with "status": "working", a job_id,
and a poll_with field naming get_job_result. A failure after
promotion is reported through get_job_result and mirrored in
get_index_status's last_reindex_error.
Outcomes and errors
- ToolError: If the index is busy or still building; retry shortly.
- IndexUnavailableError: If the index build failed or the index is broken;
get_index_statusreports the error. - ToolError: If the caller's job limit is reached when the call is promoted to a background job; the queued reindex is cancelled, so fetch pending job results and retry.
- ToolError: If the vault folder is empty while the index holds notes, as when its volume is not mounted: nothing is reindexed (#1791).
build_embeddings¶
Build Embeddings. Changes state, not destructive. Idempotent.
Bring the vector index behind semantic and hybrid search up to date with the notes; returns the number of chunks embedded.
Embeddings are built automatically, so it is needed only after reindex with
force, after a failed build (last_build_embeddings_error in
get_index_status), or with force to rebuild them all.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
force |
boolean |
false |
Re-embed every chunk, as after the embedding model changed; the current embeddings keep serving until the rebuild completes. Default false embeds only what changed. |
Returns
On inline completion, a dict with "status": "completed" and
chunks_embedded (int): the total number of chunks embedded.
When promoted, a dict with "status": "working", a job_id,
and a poll_with field naming get_job_result. A failure after
promotion is reported through get_job_result and mirrored in
get_index_status's last_build_embeddings_error.
Outcomes and errors
- ToolError: If the index is busy or still building; retry shortly.
- IndexUnavailableError: If the index build failed or the index is broken;
get_index_statusreports the error. - ToolError: If the caller's job limit is reached when the call is promoted to a background job; the queued build is cancelled, so fetch pending job results and retry.
- EmbeddingsNotConfiguredError: If no embedding provider is configured.
- ToolError: If a forced rebuild kept the existing embeddings because some embedding requests failed; retry later.