Skip to contents

Read-only query over the chroma embedding index that the companion zotero-mcp tool builds (zotero-mcp update-db). Building or refreshing that index is a separate operation of the companion tool and is never triggered by this function. Requires the companion tool's Python environment; results can lag current Zotero API data.

Usage

ztSemantic(
  query,
  limit = 10L,
  dbPath = file.path(Sys.getenv("HOME"), ".config", "zotero-mcp", "chroma_db"),
  pythonPath = file.path(Sys.getenv("HOME"), ".local", "share", "uv", "tools",
    "zotero-mcp-server", "bin", "python3")
)

Arguments

query

Natural-language query text.

limit

Maximum results.

dbPath

Chroma database directory.

pythonPath

Python interpreter of the companion environment.

Value

A data.table with itemKey, groupID, title, distance (smaller is closer).

Details

The defaults target one common Unix uv tool installation and index layout; pass pythonPath and dbPath for other environments. The function requires local access to a compatible Chroma collection named zotero_library, launches that Python interpreter once, and converts its JSON result to a data.table. It never creates or refreshes the semantic index. The current query has no library selector: limit applies across all indexed personal and group records, whose groupID is returned for inspection.

Examples

# \donttest{
# Requires the companion Python environment and a populated semantic index.
# These paths match the default Unix uv installation; adapt them as needed.
Python <- file.path(path.expand("~"), ".local", "share", "uv", "tools",
                    "zotero-mcp-server", "bin", "python3")
Index <- file.path(path.expand("~"), ".config", "zotero-mcp", "chroma_db")
if (file.exists(Python) && file.exists(file.path(Index, "chroma.sqlite3"))) {
  ztSemantic("conditional mean spectrum", limit = 5L,
             pythonPath = Python, dbPath = Index)
}
# }