From d231fcce677aecbb258fc6004861bae91f22b98c Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Thu, 15 Jan 2026 14:16:08 +0200 Subject: [PATCH] feat(Session 241): Add scale-out MCP tools Position Exit Management System support: - scale_out_status: Service status and statistics - scale_out_pending: Positions awaiting scale-out - scale_out_stats: Execution statistics - scale_out_set_dry_run: Toggle dry-run mode Co-Authored-By: Claude Opus 4.5 --- src/server.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/server.py b/src/server.py index a5d0b53..29f5d50 100644 --- a/src/server.py +++ b/src/server.py @@ -385,6 +385,33 @@ async def list_tools() -> list[Tool]: description="Find duplicate pending orders (same instrument + rate + direction). Returns order IDs to cancel.", inputSchema={"type": "object", "properties": {}, "required": []}, ), + # === SCALE-OUT (Session 241: Position Exit Management) === + Tool( + name="scale_out_status", + description="Get scale-out monitor service status (running, dry-run mode, statistics)", + inputSchema={"type": "object", "properties": {}, "required": []}, + ), + Tool( + name="scale_out_pending", + description="Get positions pending scale-out (haven't had 50% partial close executed yet)", + inputSchema={"type": "object", "properties": {}, "required": []}, + ), + Tool( + name="scale_out_stats", + description="Get scale-out statistics (total, executed, pending, P/L locked)", + inputSchema={"type": "object", "properties": {}, "required": []}, + ), + Tool( + name="scale_out_set_dry_run", + description="Enable or disable scale-out dry-run mode. In dry-run, scale-outs are logged but not executed.", + inputSchema={ + "type": "object", + "properties": { + "dry_run": {"type": "boolean", "description": "True to enable dry-run (log only), False to enable live execution"}, + }, + "required": ["dry_run"], + }, + ), # === CONTAINER OPERATIONS === Tool( name="container_logs", @@ -578,6 +605,15 @@ async def call_tool(name: str, arguments: dict[str, Any]) -> list[TextContent]: result = await api_post("/api/trade/orders/cancel-bulk", {"order_ids": order_ids}) case "find_duplicate_orders": result = await api_get("/api/trade/orders/duplicates") + # === SCALE-OUT (Session 241) === + case "scale_out_status": + result = await api_get("/api/trade/scale-out/status") + case "scale_out_pending": + result = await api_get("/api/trade/scale-out/pending") + case "scale_out_stats": + result = await api_get("/api/trade/scale-out/stats") + case "scale_out_set_dry_run": + result = await api_post("/api/trade/scale-out/dry-run", {"dry_run": arguments["dry_run"]}) # === CONTAINER OPERATIONS === case "container_logs": params = [f"container={arguments['container']}"]