From 39da5c4f0640aba92fe33f903274563aa4e448a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=9A=D1=83=D1=82?= =?UTF-8?q?=D0=BB=D0=B0=D1=85=D0=BC=D0=B5=D1=82=D0=BE=D0=B2?= Date: Mon, 25 May 2026 22:57:31 +0000 Subject: [PATCH] Add solution for 69f8e929da860fb4533faa2a --- memory_client.py | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/memory_client.py b/memory_client.py index ff49d86..b51ba1a 100644 --- a/memory_client.py +++ b/memory_client.py @@ -1,33 +1,26 @@ -from __future__ import annotations - +from fastmcp import Client import asyncio -from fastmcp import Client - - -def unwrap(result): - return getattr(result, "data", result) - - async def main(): - async with Client("memory_server.py") as client: + client = Client("python memory_server.py") + await client.connect() + try: result = await client.call_tool( "save_with_namespace", - {"key": "username", "value": "\u0410\u043b\u0435\u043a\u0441\u0435\u0439", "namespace": "default"}, + {"key": "username", "value": "Алексей", "namespace": "default"} ) - print(f"Сохранено: {unwrap(result)}") - + print(f"Сохранено: {result}") result = await client.call_tool( "get_by_namespace", - {"namespace": "default"}, + {"namespace": "default"} ) print("Данные namespace 'default':") - for item in unwrap(result): + for item in result: print(f" {item['key']}: {item['value']}") - keys = await client.call_tool("list_keys", {"pattern": "*name"}) - print(f"Ключи с 'name': {unwrap(keys)}") - + print(f"Ключи с 'name': {keys}") + finally: + await client.close() if __name__ == "__main__": - asyncio.run(main()) + asyncio.run(main()) \ No newline at end of file