fix: handle memory:// url format in read_note tool · basicmachines-co/basic-memory@e080373 · GitHub
Skip to content

Commit e080373

Browse files
author
phernandez
committed
fix: handle memory:// url format in read_note tool
1 parent 65ebe5d commit e080373

6 files changed

Lines changed: 30 additions & 6 deletions

File tree

src/basic_memory/cli/commands/mcp.py

Lines changed: 1 addition & 1 deletion

src/basic_memory/mcp/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from basic_memory.api.app import app as fastapi_app
44

5-
BASE_URL = "http://test"
5+
BASE_URL = "memory://"
66

77
# Create shared async client
88
client = AsyncClient(transport=ASGITransport(app=fastapi_app), base_url=BASE_URL)

src/basic_memory/mcp/tools/notes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from basic_memory.schemas import EntityResponse, DeleteEntitiesResponse
1414
from basic_memory.schemas.base import Entity
1515
from basic_memory.mcp.tools.utils import call_get, call_put, call_delete
16+
from basic_memory.schemas.memory import memory_url_path
1617

1718

1819
@mcp.tool(
@@ -96,7 +97,9 @@ async def read_note(identifier: str) -> str:
9697
Raises:
9798
ValueError: If the note cannot be found
9899
"""
99-
response = await call_get(client, f"/resource/{identifier}")
100+
logger.info(f"Reading note {identifier}")
101+
url = memory_url_path(identifier)
102+
response = await call_get(client, f"/resource/{url}")
100103
return response.text
101104

102105

src/basic_memory/sync/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
"""Types and utilities for file sync."""
22

33
from dataclasses import dataclass, field
4-
from typing import Set, Dict, Optional
4+
from typing import Set, Dict
55

6-
from watchfiles import Change
76

87

98

tests/mcp/test_tool_notes.py

Lines changed: 22 additions & 0 deletions

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)