diff --git a/src/server.py b/src/server.py index c82a7ef..84da950 100644 --- a/src/server.py +++ b/src/server.py @@ -527,6 +527,45 @@ async def list_tools() -> list[Tool]: "required": ["container", "confirm"], }, ), + # === SESSION 452: 24/5 TRADING & CRYPTO FOCUS === + Tool( + name="market_closure_context", + description="Get current market closure context and crypto allocation adjustments", + inputSchema={"type": "object", "properties": {}, "required": []}, + ), + Tool( + name="pi_consensus_query", + description="Get PI consensus data for a symbol (3+ PIs holding)", + inputSchema={ + "type": "object", + "properties": { + "symbol": {"type": "string", "description": "Ticker symbol (e.g., BTC, NVDA, AAPL)"}, + }, + "required": ["symbol"], + }, + ), + Tool( + name="pi_consensus_top", + description="Get top PI consensus opportunities", + inputSchema={ + "type": "object", + "properties": { + "limit": {"type": "number", "default": 10, "description": "Max results (1-100)"}, + }, + "required": [], + }, + ), + Tool( + name="pi_scan_trigger", + description="Trigger manual PI portfolio scan", + inputSchema={ + "type": "object", + "properties": { + "usernames": {"type": "string", "description": "Comma-separated PI usernames (optional)"}, + }, + "required": [], + }, + ), ] @@ -615,7 +654,12 @@ async def call_tool(name: str, arguments: dict[str, Any]) -> list[TextContent]: case "rate_limiter": result = await api_get("/api/monitoring/rate_limiter/stats") case "portfolio_allocation": - result = await api_get("/api/portfolio/status") + # Get positions and extract allocation breakdown + positions_data = await api_get("/api/trade/positions") + if positions_data and "summary" in positions_data and "by_asset_class" in positions_data["summary"]: + result = positions_data["summary"]["by_asset_class"] + else: + result = {"error": "Asset allocation data not available"} case "create_order": payload = { "symbol": arguments["symbol"], @@ -754,6 +798,22 @@ async def call_tool(name: str, arguments: dict[str, Any]) -> list[TextContent]: result = await api_post( f"/containers/restart?container={arguments['container']}&confirm={str(arguments.get('confirm', False)).lower()}" ) + # === SESSION 452: 24/5 TRADING & CRYPTO FOCUS === + case "market_closure_context": + # Get market closure context from dashboard + result = await api_get("/api/dashboard/market-closure-context") + case "pi_consensus_query": + symbol = arguments["symbol"].upper() + result = await api_get(f"/api/pi-intelligence/consensus/{symbol}") + case "pi_consensus_top": + limit = arguments.get("limit", 10) + result = await api_get(f"/api/pi-intelligence/consensus/top?limit={limit}") + case "pi_scan_trigger": + usernames = arguments.get("usernames") + endpoint = "/api/pi-intelligence/scan/trigger" + if usernames: + endpoint += f"?usernames={usernames}" + result = await api_post(endpoint) case _: result = {"error": f"Unknown tool: {name}"}