Skip to content

fix(mcp): resolve project arg by unique name tail when exact lookup misses#1054

Merged
DeusData merged 1 commit into
mainfrom
fix/1025-project-suffix-resolution
Jul 12, 2026
Merged

fix(mcp): resolve project arg by unique name tail when exact lookup misses#1054
DeusData merged 1 commit into
mainfrom
fix/1025-project-suffix-resolution

Conversation

@DeusData

Copy link
Copy Markdown
Owner

Closes #1025

Bug

Agents naturally pass the repo folder name (codebase-memory-mcp), but indexed project names derive from the full path (E:\project\graph\xE-project-graph-x). Every graph tool then answered project not found or not indexed while list_projects clearly showed the project — an unguessable name for any MCP client.

Fix

get_project_arg (the shared getter behind all 11 project-taking tools, same choke point as the #640 aliases) gains a tail-resolution fallback: when no <project>.db exists, scan cache-dir filenames for a segment-aligned tail match (-<project>.db):

  • exactly one match → adopt that project's full name (logged as mcp.project_tail_resolved)
  • zero or several → keep the original name, so the existing not-found error with the candidate list fires — never guess between projects

Exact names never enter the scan (fast path untouched); internal-name drift stays #704's separate fallback in resolve_store. Filename-level only — no DB opens on the fallback path.

Reproduce-first

tool_project_arg_resolves_unique_tail_issue1025 indexes three real fixtures under an overridden CBM_CACHE_DIR (E-project-graph-suffix1025, F-alpha-amb1025, G-beta-amb1025) and asserts: unique tail suffix1025 resolves (RED on main: project-not-found), ambiguous tail amb1025 stays an error, and the exact full name keeps working.

Verification

Full local suite 6005 passed, 1 skipped, zero regressions; lint-ci clean.

…isses

Agents naturally pass the repo folder name (codebase-memory-mcp), but
indexed project names derive from the full path (E:\project\graph\x
-> E-project-graph-x), so every graph tool answered 'project not found
or not indexed' while list_projects clearly showed the project.

get_project_arg now falls back to a cache-dir filename scan when no
<project>.db exists: a passed name matching exactly ONE indexed
project as a segment-aligned tail (-<name>.db) adopts that project's
full name (logged); zero or several matches keep the original name so
the existing not-found error with the candidate list fires. Exact
names never enter the scan, and internal-name drift stays #704's
fallback in resolve_store.

Closes #1025

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData DeusData added this to the 0.9.1-rc milestone Jul 12, 2026
@DeusData DeusData enabled auto-merge July 12, 2026 16:50
@DeusData DeusData merged commit 71cd27f into main Jul 12, 2026
21 checks passed
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.

opencode calling search_graph returns "project not found" but list_projects shows available projects

1 participant