You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fetch MCP tool's schema only takes id. There is no project_id / project parameter, so it always resolves the permalink against the default project. When a permalink references a note in any other project (including in the same workspace, or in an org workspace), the tool returns "Note Not Found" plus unrelated suggestions from the default project.
fetch(id="getting-started/notes/org-endpoint-smoke-test")
→
{
"title": "Org Endpoint Smoke Test",
"text": "# Note Not Found in main: \"getting-started/notes/org-endpoint-smoke-test\" ...",
"metadata": {"error": "Document not found"}
}
The "related notes" returned are from a completely different project (open-ghl-mcp/...) — i.e. fetch defaulted to main regardless of the permalink prefix.
Other read tools (read_note, read_content, view_note) accept project_id and work correctly.
Expected
fetch should accept a project_id (and/or project) parameter matching the rest of the tool surface, and use it to resolve the permalink. Without that, fetch is unusable for any project other than the user's default.
Find and read the fetch tool implementation (src/basic_memory/mcp/tools/chatgpt_tools.py:162)
Check how read_note implements project_id — it accepts project and project_id, passes to get_project_client()
Add labels for triage (bug)
Implement fix: add project and project_id parameters to fetch tool, pass to read_note
Add test: test_fetch_forwards_project_parameters verifies params are forwarded correctly
Commit and push changes
Fix Summary
Root cause:fetch in chatgpt_tools.py called read_note(identifier=id, context=context) without forwarding any project routing — so it always resolved against the default project.
Change: Added project: Optional[str] = None and project_id: Optional[str] = None to fetch's signature and forwarded them to read_note, matching the interface of read_note, read_content, and view_note.
Files changed:
src/basic_memory/mcp/tools/chatgpt_tools.py — added project/project_id params, forwarded to read_note
Took a closer look — adding project/project_id to fetch isn't the right fix, even though it's the most direct read of the issue title.
Why: OpenAI's compatibility schema for fetch is strict — fetch(id: str) -> FetchResult, single param. See openai/sample-deep-research-mcp and the Building MCP servers for ChatGPT docs. The whole reason chatgpt_tools.py exists as a separate adapter (vs. just exposing read_note) is to mirror that exact shape — its module docstring even calls this out. ChatGPT will never callfetch with project_id; it only ever passes back an id it got from search. So a wider schema only helps humans typing into MCP clients directly (which is the repro in this issue, but not the production path).
Real root cause is in search, not fetch._format_search_results_for_chatgpt (chatgpt_tools.py:47-52) returns id = permalink — a bare permalink with no project disambiguation. When two projects have overlapping namespaces (the repro: Personal/getting-started and drew-cain/getting-started), the IDs collide and fetch resolves against the default project.
Proposed fix: make search return project-qualified IDs (e.g. memory://<project>/<permalink> or <project_id>:<permalink>) and have fetch parse the project out of id before delegating to read_note. ChatGPT keeps working unchanged; cross-project routing Just Works; the strict OpenAI schema is preserved.
This is almost certainly the same root cause as #783 (workspace-disambiguated permalinks, teams blocker) — likely worth fixing together.
Closing the claude/issue-782-20260503-0116 branch since the param-forwarding approach there isn't the direction we want.
Related thought tracked in #786: if we exposed a settings (or session/set_active_project) MCP tool, the LLM could establish project/workspace context out-of-band — so even tools with strict input schemas like fetch(id: str) could route to the right project without violating OpenAI's compatibility contract. That's a complement to the project-qualified-ID fix proposed above, not a replacement: qualified IDs handle the per-call case, settings handle the conversational-context case.
Verified this is fixed on origin/main by #808. The ChatGPT-compatible fetch schema still stays strict (fetch(id) only), but path-like IDs are now converted to routable memory://... identifiers before delegating to read_note, which lets the workspace/project-qualified permalink routing handle the non-default project case.
Validation on a clean detached origin/main worktree at df5e8d80:
uv run ruff check src/basic_memory/mcp/tools/chatgpt_tools.py tests/mcp/tools/test_chatgpt_tools.py
uv run pytest tests/mcp/tools/test_chatgpt_tools.py -q --no-cov (13 passed)
Activity
claude commentedon May 3, 2026
Claude finished @groksrc's task in 2m 37s —— View job •
claude/issue-782-20260503-0116• Create PR ➔Analysis & Implementation Plan
fetchtool implementation (src/basic_memory/mcp/tools/chatgpt_tools.py:162)read_noteimplementsproject_id— it acceptsprojectandproject_id, passes toget_project_client()bug)projectandproject_idparameters tofetchtool, pass toread_notetest_fetch_forwards_project_parametersverifies params are forwarded correctlyFix Summary
Root cause:
fetchinchatgpt_tools.pycalledread_note(identifier=id, context=context)without forwarding any project routing — so it always resolved against the default project.Change: Added
project: Optional[str] = Noneandproject_id: Optional[str] = Nonetofetch's signature and forwarded them toread_note, matching the interface ofread_note,read_content, andview_note.Files changed:
src/basic_memory/mcp/tools/chatgpt_tools.py— addedproject/project_idparams, forwarded toread_notetests/mcp/tools/test_chatgpt_tools.py— addedtest_fetch_forwards_project_parametersTriage: Bug · Medium priority · MCP tool component · Simple fix
groksrc commentedon May 3, 2026
Took a closer look — adding
project/project_idtofetchisn't the right fix, even though it's the most direct read of the issue title.Why: OpenAI's compatibility schema for
fetchis strict —fetch(id: str) -> FetchResult, single param. See openai/sample-deep-research-mcp and the Building MCP servers for ChatGPT docs. The whole reasonchatgpt_tools.pyexists as a separate adapter (vs. just exposingread_note) is to mirror that exact shape — its module docstring even calls this out. ChatGPT will never callfetchwithproject_id; it only ever passes back anidit got fromsearch. So a wider schema only helps humans typing into MCP clients directly (which is the repro in this issue, but not the production path).Real root cause is in
search, notfetch._format_search_results_for_chatgpt(chatgpt_tools.py:47-52) returnsid = permalink— a bare permalink with no project disambiguation. When two projects have overlapping namespaces (the repro:Personal/getting-startedanddrew-cain/getting-started), the IDs collide andfetchresolves against the default project.Proposed fix: make
searchreturn project-qualified IDs (e.g.memory://<project>/<permalink>or<project_id>:<permalink>) and havefetchparse the project out ofidbefore delegating toread_note. ChatGPT keeps working unchanged; cross-project routing Just Works; the strict OpenAI schema is preserved.This is almost certainly the same root cause as #783 (workspace-disambiguated permalinks, teams blocker) — likely worth fixing together.
Closing the
claude/issue-782-20260503-0116branch since the param-forwarding approach there isn't the direction we want.groksrc commentedon May 3, 2026
Related thought tracked in #786: if we exposed a
settings(orsession/set_active_project) MCP tool, the LLM could establish project/workspace context out-of-band — so even tools with strict input schemas likefetch(id: str)could route to the right project without violating OpenAI's compatibility contract. That's a complement to the project-qualified-ID fix proposed above, not a replacement: qualified IDs handle the per-call case, settings handle the conversational-context case.phernandez commentedon May 3, 2026
I think if we make the permalink fix to include the workspace it would solve this issue, right, @groksrc ?
groksrc commentedon May 4, 2026
Yes it will, let's close this once we ship that feature.
phernandez commentedon May 11, 2026
Verified this is fixed on
origin/mainby #808. The ChatGPT-compatible fetch schema still stays strict (fetch(id)only), but path-like IDs are now converted to routablememory://...identifiers before delegating toread_note, which lets the workspace/project-qualified permalink routing handle the non-default project case.Validation on a clean detached
origin/mainworktree atdf5e8d80:uv run ruff check src/basic_memory/mcp/tools/chatgpt_tools.py tests/mcp/tools/test_chatgpt_tools.pyuv run pytest tests/mcp/tools/test_chatgpt_tools.py -q --no-cov(13 passed)