Skip to content

fix(mcp): clarify oc_search vs oc_manifest routing for agents#33

Open
wormuz wants to merge 2 commits into
0xranx:mainfrom
wormuz:fix/mcp-tool-descriptions
Open

fix(mcp): clarify oc_search vs oc_manifest routing for agents#33
wormuz wants to merge 2 commits into
0xranx:mainfrom
wormuz:fix/mcp-tool-descriptions

Conversation

@wormuz
Copy link
Copy Markdown
Contributor

@wormuz wormuz commented May 8, 2026

oc_search matches document body text only — it does not index folder or file names. Agents searching for a project by name (e.g. oc_search("onepass")) got zero results and incorrectly concluded the project didn't exist.

Changes:

  • oc_search description: added explicit warning — "Does NOT match folder/file names — to browse a known project use oc_manifest({ folder_path: "project-name" }) instead"
  • oc_manifest description: added routing hint — "Use this when you know the project/folder name — oc_search matches content only, not names"

Konstantin Cheremisov added 2 commits May 6, 2026 11:50
Files written under ~/.opencontext/contexts/ via Write/Edit (bypassing
oc_create_doc) used to silently disappear from oc_manifest and oc_search
because the manifest was a pure SELECT from SQLite. Agents thought the
folder was empty and proposed re-creating it.

Three changes that make the drift impossible to miss:

1. oc_manifest now scans the filesystem after the SELECT and returns
   { items, unindexed_files }. When unindexed_files is non-empty, MCP
   surfaces a `warning` field naming each file. Manifest stays read-only
   - no auto-insert.

2. New `oc index reconcile [folder]` CLI command and `oc_reconcile_folder`
   MCP tool. They INSERT a docs row for every *.md present on disk but
   missing from SQLite, without recomputing embeddings (run
   `oc index build` separately for that). Fast path for picking up
   orphans after a Write or `git pull`.

3. oc_create_doc / oc_set_doc_desc descriptions now open with a hard
   "REQUIRED for any file under ~/.opencontext/contexts/" notice that
   explicitly calls out Write/Edit as a bug, so MCP-aware agents stop
   reaching for them.

Rust core gains generate_manifest_full() and reconcile_folder() (the
old generate_manifest is preserved for Tauri/UI/CLI callers). NAPI
binding switches generateManifest to the wrapped form; existing JS
callers updated. Three new core tests cover orphan detection,
nested-folder scan, and reconcile idempotency. Tested end-to-end on a
real folder with 6 orphans - manifest reported drift, reconcile
registered all 6, follow-up manifest came back clean.
oc_search matches document body only — not folder/file names.
Agents searching by project name got 0 results and wrongly concluded
the project doesn't exist.

Add explicit routing hint to both descriptions:
- oc_search: 'Does NOT match folder/file names — use oc_manifest for known projects'
- oc_manifest: 'Use this when you know the project/folder name — oc_search matches content only'
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.

1 participant