Skip to content

Add refresh and embed MCP tools for index maintenance#464

Open
goldsr09 wants to merge 1 commit intotobi:mainfrom
goldsr09:fix/mcp-refresh-embed-tools
Open

Add refresh and embed MCP tools for index maintenance#464
goldsr09 wants to merge 1 commit intotobi:mainfrom
goldsr09:fix/mcp-refresh-embed-tools

Conversation

@goldsr09
Copy link
Copy Markdown

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 optional collection parameter 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, then embed, and the note is immediately searchable.

Design decisions

  • Named refresh and embed (not refresh_paths / embed_dirty) to match existing verb-based naming (query, get, status)
  • Marked with readOnlyHint: false annotation
  • refresh returns structured counts (new, updated, unchanged, removed)
  • embed returns docs processed, chunks embedded, duration, error count
  • Updated buildInstructions() so LLMs see the new tools in the server's instructions

Test plan

  • 5 new end-to-end tests over HTTP transport:
    • refresh scans files and returns update results
    • refresh with collection filter works
    • refresh detects new files added after initial scan
    • embed generates embeddings
    • search finds documents after refresh
  • Updated tools/list assertion to include new tools
  • Full MCP test suite passes

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants