fix: memory_client.py — MCP-сервер для управления памятью агента
This commit is contained in:
+10
-7
@@ -6,20 +6,23 @@ async def main():
|
||||
client = Client("python memory_server.py")
|
||||
await client.connect()
|
||||
try:
|
||||
# Save a value in default namespace
|
||||
# Save a value in the default namespace
|
||||
saved = await client.call_tool(
|
||||
"save_with_namespace",
|
||||
{"key": "username", "value": "Алексей", "namespace": "default"},
|
||||
{"key": "username", "value": "Алексей", "namespace": "default"}
|
||||
)
|
||||
print(f"Saved: {saved}")
|
||||
|
||||
# Retrieve all values from default namespace
|
||||
data = await client.call_tool("get_by_namespace", {"namespace": "default"})
|
||||
print("Namespace 'default' contents:")
|
||||
# Retrieve all values from the default namespace
|
||||
data = await client.call_tool(
|
||||
"get_by_namespace",
|
||||
{"namespace": "default"}
|
||||
)
|
||||
print("Data in namespace 'default':")
|
||||
for item in data:
|
||||
print(f" {item['key']}: {item['value']} (ts={item['timestamp']})")
|
||||
print(f" {item['key']}: {item['value']}")
|
||||
|
||||
# List keys matching pattern
|
||||
# List keys matching a pattern
|
||||
keys = await client.call_tool("list_keys", {"pattern": "*name"})
|
||||
print(f"Keys matching '*name': {keys}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user