Skip to content

Commit 2feecdf

Browse files
phernandezclaude
andcommitted
fix: ChatGPT search/fetch tools broken in cloud mode (#644)
Both search() and fetch() read default_project from ConfigManager, which returns None in cloud mode. Remove the manual ConfigManager lookup and let the underlying search_notes/read_note resolve the project via get_project_client(), which works in both modes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent 195229f commit 2feecdf

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

src/basic_memory/mcp/tools/chatgpt_tools.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
import json
99
from typing import Any, Dict, List, Optional
10-
from loguru import logger
10+
1111
from fastmcp import Context
12+
from loguru import logger
1213

1314
from basic_memory.mcp.server import mcp
14-
from basic_memory.mcp.tools.search import search_notes
1515
from basic_memory.mcp.tools.read_note import read_note
16-
from basic_memory.config import ConfigManager
16+
from basic_memory.mcp.tools.search import search_notes
1717
from basic_memory.schemas.search import SearchResponse, SearchResult
1818

1919

@@ -113,16 +113,12 @@ async def search(
113113
logger.info(f"ChatGPT search request: query='{query}'")
114114

115115
try:
116-
# ChatGPT tools don't expose project parameter, so use default project
117-
config = ConfigManager().config
118-
default_project = config.default_project
119-
120-
# Call underlying search_notes with sensible defaults for ChatGPT
116+
# Let search_notes resolve the default project via get_project_client(),
117+
# which works in both local mode (ConfigManager) and cloud mode (database).
121118
results = await search_notes(
122119
query=query,
123-
project=default_project, # Use default project for ChatGPT
124120
page=1,
125-
page_size=10, # Reasonable default for ChatGPT consumption
121+
page_size=10,
126122
output_format="json",
127123
context=context,
128124
)
@@ -180,17 +176,13 @@ async def fetch(
180176
logger.info(f"ChatGPT fetch request: id='{id}'")
181177

182178
try:
183-
# ChatGPT tools don't expose project parameter, so use default project
184-
config = ConfigManager().config
185-
default_project = config.default_project
186-
187-
# Call underlying read_note function (default output_format="text" returns str)
179+
# Let read_note resolve the default project via get_project_client(),
180+
# which works in both local mode (ConfigManager) and cloud mode (database).
188181
content = str(
189182
await read_note(
190183
identifier=id,
191-
project=default_project, # Use default project for ChatGPT
192184
page=1,
193-
page_size=10, # Default pagination
185+
page_size=10,
194186
context=context,
195187
)
196188
)

0 commit comments

Comments
 (0)