Add refresh and embed MCP tools for index maintenance#464
Open
Add refresh and embed MCP tools for index maintenance#464
Conversation
Add two new MCP tools so LLM clients can trigger re-indexing and embedding generation after writing notes via another tool (e.g., obsidian-mcp). Also updates buildInstructions to advertise the maintenance tools.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses #434 (MCP feature parity)
The MCP server currently only exposes read-only tools (
query,get,multi_get,status). This means AI agents that write notes via another tool (e.g., obsidian-mcp, filesystem tools) have no way to make those notes searchable without manual CLI intervention.This PR adds two maintenance tools:
refresh— re-scans collection(s) for file changes, updates the DB + FTS index. Accepts optionalcollectionparameter to scope the refresh.embed— generates vector embeddings for documents that need them.These close the write loop: an agent can write a note, call
refresh, thenembed, and the note is immediately searchable.Design decisions
refreshandembed(notrefresh_paths/embed_dirty) to match existing verb-based naming (query,get,status)readOnlyHint: falseannotationrefreshreturns structured counts (new, updated, unchanged, removed)embedreturns docs processed, chunks embedded, duration, error countbuildInstructions()so LLMs see the new tools in the server's instructionsTest plan
refresh scans files and returns update resultsrefresh with collection filter worksrefresh detects new files added after initial scanembed generates embeddingssearch finds documents after refreshtools/listassertion to include new tools