Spaces:
Sleeping
Sleeping
Download tools/dev/scratch_test.py from JacellJamble/genesis: direct link, hf CLI and curl.
- Browser
- Download file 2.31 kB
-
https://huggingface.co/spaces/JacellJamble/genesis/resolve/main/tools/dev/scratch_test.py
- Command line
-
hf download hf://spaces/JacellJamble/genesis/tools/dev/scratch_test.py
-
curl -L -o scratch_test.py https://huggingface.co/spaces/JacellJamble/genesis/resolve/main/tools/dev/scratch_test.py
2.31 kB
| import os | |
| import sys | |
| import asyncio | |
| from mcp import ClientSession, StdioServerParameters | |
| from mcp.client.stdio import stdio_client | |
| async def main(): | |
| # Parameters to start the server | |
| server_params = StdioServerParameters( | |
| command="python", | |
| args=["-m", "server.app"], | |
| env=os.environ.copy() | |
| ) | |
| print("Starting GENESIS MCP Server smoke test...") | |
| async with stdio_client(server_params) as (read, write): | |
| async with ClientSession(read, write) as session: | |
| # Initialize | |
| await session.initialize() | |
| # List tools | |
| tools = await session.list_tools() | |
| print(f"Registered tools: {[t.name for t in tools.tools]}") | |
| episode_id = "smoke_test_1" | |
| # 1. Reset | |
| print("\nTesting 'reset'...") | |
| res = await session.call_tool("reset", {"episode_id": episode_id, "difficulty": 2}) | |
| print(f"Reset response: {res.content[0].text}") | |
| # 2. Daily Briefing (as CEO) | |
| print("\nTesting 'get_daily_briefing' (CEO)...") | |
| res = await session.call_tool("get_daily_briefing", {"episode_id": episode_id, "agent_role": "ceo"}) | |
| print(f"Briefing response: {res.content[0].text[:200]}...") | |
| # 3. Build Feature (as CTO) | |
| print("\nTesting 'build_feature' (CTO)...") | |
| res = await session.call_tool("build_feature", { | |
| "episode_id": episode_id, | |
| "agent_role": "cto", | |
| "name": "Cloud Scaling", | |
| "complexity": "medium", | |
| "engineers": 2 | |
| }) | |
| print(f"Build Feature response: {res.content[0].text}") | |
| # 4. Unauthorized Check | |
| print("\nTesting unauthorized 'build_feature' (CEO)...") | |
| res = await session.call_tool("build_feature", { | |
| "episode_id": episode_id, | |
| "agent_role": "ceo", | |
| "name": "Secret Feature", | |
| "complexity": "low", | |
| "engineers": 1 | |
| }) | |
| print(f"Unauthorized response: {res.content[0].text}") | |
| print("\nSmoke test passed!") | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |