()
| 9 | |
| 10 | |
| 11 | async def test(): |
| 12 | print("Initializing ToolManager...") |
| 13 | tm = ToolManager( |
| 14 | config_file="server_config.json", |
| 15 | servers=["monday"], |
| 16 | ) |
| 17 | |
| 18 | await tm.initialize() |
| 19 | print(f"✓ Initialized with timeout: {tm._effective_timeout}s\n") |
| 20 | |
| 21 | # Test 1: Simple ping-like tool |
| 22 | print("=" * 80) |
| 23 | print("TEST 1: list_users_and_teams (should be fast)") |
| 24 | print("=" * 80) |
| 25 | |
| 26 | start = time.time() |
| 27 | result = await tm.execute_tool("list_users_and_teams", {"getMe": True}) |
| 28 | elapsed = time.time() - start |
| 29 | |
| 30 | print(f"Result: {result.success}") |
| 31 | print(f"Elapsed: {elapsed:.2f}s") |
| 32 | if not result.success: |
| 33 | print(f"Error: {result.error}") |
| 34 | print() |
| 35 | |
| 36 | # Test 2: The problematic list_workspaces |
| 37 | print("=" * 80) |
| 38 | print("TEST 2: list_workspaces (the slow one)") |
| 39 | print("=" * 80) |
| 40 | |
| 41 | start = time.time() |
| 42 | result = await tm.execute_tool("list_workspaces", {"limit": 10}) # Small limit |
| 43 | elapsed = time.time() - start |
| 44 | |
| 45 | print(f"Result: {result.success}") |
| 46 | print(f"Elapsed: {elapsed:.2f}s") |
| 47 | if not result.success: |
| 48 | print(f"Error: {result.error}") |
| 49 | |
| 50 | await tm.close() |
| 51 | |
| 52 | |
| 53 | if __name__ == "__main__": |
no test coverage detected