Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring
TypeScript diagramhomelabhomelab-infrastructure-observabilitynetworkproxmox-veself-hostedzigbeezwavezwave-js
feat(mcp): add delete_design tool
Nicola Bottini8df7f682e0e3
diff --git a/mcp/app/tools.py b/mcp/app/tools.pyindex 502d2d3..03fc69e 100644--- a/mcp/app/tools.py+++ b/mcp/app/tools.py@@ -163,6 +163,13 @@ def _build_tools() -> list[Tool]:"design_type": {"type": "string", "description": "Design type (default: network)."},},}),+ Tool(name="delete_design", description="Delete a design (canvas) and all its nodes and edges. The last remaining design cannot be deleted.", inputSchema={+ "type": "object",+ "required": ["design_id"],+ "properties": {+ "design_id": {"type": "string", "description": "ID of the design to delete. Call list_designs to discover IDs."},+ },+ }),]@@ -272,4 +279,7 @@ async def _dispatch(name: str, args: dict) -> dict:if name == "create_design":return await backend.post("/api/v1/designs", args)+ if name == "delete_design":+ return await backend.delete(f"/api/v1/designs/{args['design_id']}")+raise ValueError(f"Unknown tool: {name}")diff --git a/mcp/tests/test_tools.py b/mcp/tests/test_tools.pyindex 6dbf197..009ebdd 100644--- a/mcp/tests/test_tools.py+++ b/mcp/tests/test_tools.py@@ -262,6 +262,18 @@ def test_create_design_schema_requires_name():assert tool.inputSchema["required"] == ["name"]+async def test_delete_design(mock_backend):+ await _dispatch("delete_design", {"design_id": "d-old"})+ mock_backend.delete.assert_called_once_with("/api/v1/designs/d-old")+++def test_delete_design_schema_requires_design_id():+ tool = next(t for t in TOOLS if t.name == "delete_design")+ assert tool.inputSchema["required"] == ["design_id"]+ assert "design_id" in tool.inputSchema["properties"]++@pytest.mark.anyioasync def test_unknown_tool():with pytest.raises(ValueError, match="Unknown tool"):