Add generic memory gateway v1
This commit is contained in:
29
tests/test_v1_mcp.py
Normal file
29
tests/test_v1_mcp.py
Normal file
@ -0,0 +1,29 @@
|
||||
import asyncio
|
||||
|
||||
from memory_gateway.repositories import InMemoryRepository
|
||||
from memory_gateway.services import MemoryGatewayService
|
||||
|
||||
|
||||
def test_v1_mcp_tools_are_exposed_and_dispatch(monkeypatch):
|
||||
import memory_gateway.server as server
|
||||
|
||||
service = MemoryGatewayService(InMemoryRepository())
|
||||
monkeypatch.setattr(server, "v1_service", service)
|
||||
|
||||
tools = asyncio.run(server.list_tools())
|
||||
assert any(tool.name == "memory_search" for tool in tools)
|
||||
assert any(tool.name == "memory_commit_session" for tool in tools)
|
||||
|
||||
result = asyncio.run(
|
||||
server.call_v1_memory_tool(
|
||||
"memory_upsert",
|
||||
{
|
||||
"user_id": "user_a",
|
||||
"content": "MCP 写入的 v1 memory",
|
||||
"visibility": "private",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
assert result["user_id"] == "user_a"
|
||||
assert result["namespace"] == "user/user_a/long_term"
|
||||
Reference in New Issue
Block a user