:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(mcp): let agents size dashboard tiles (#100939)
posthog[bot]a4fde0313d3e
diff --git a/posthog/api/test/dashboards/test_dashboard.py b/posthog/api/test/dashboards/test_dashboard.pyindex 6f4cebf9c49e..70b8aece946b 100644--- a/posthog/api/test/dashboards/test_dashboard.py+++ b/posthog/api/test/dashboards/test_dashboard.py@@ -1420,6 +1420,44 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):assert body["id"] == dashboard_idassert DashboardTile.objects_including_soft_deleted.get(id=tile.id).deleted is True+ @parameterized.expand(+ [+ ("negative x", {"x": -1, "y": 0, "w": 6, "h": 5}),+ ("negative y", {"x": 0, "y": -1, "w": 6, "h": 5}),+ ("zero width", {"x": 0, "y": 0, "w": 0, "h": 5}),+ ("zero height", {"x": 0, "y": 0, "w": 6, "h": 0}),+ ("extends past grid", {"x": 10, "y": 0, "w": 3, "h": 5}),+ ]+ )+ def test_layout_patch_rejects_invalid_desktop_grid_box(self, _name: str, layout: dict[str, int]) -> None:+ dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "dashboard"})+ insight_id, _ = self.dashboard_api.create_insight({"dashboards": [dashboard_id], "name": "insight"})+ tile = DashboardTile.objects.get(insight_id=insight_id, dashboard_id=dashboard_id)++ _, response = self.dashboard_api.update_dashboard(+ dashboard_id,+ {"tiles": [{"id": tile.id, "layouts": {"sm": layout}}]},+ expected_status=status.HTTP_400_BAD_REQUEST,+ )++ assert response["attr"].startswith("layouts__sm__")++ def test_layout_patch_merges_breakpoint_with_existing_layout(self) -> None:+ dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "dashboard"})+ insight_id, _ = self.dashboard_api.create_insight({"dashboards": [dashboard_id], "name": "insight"})+ tile = DashboardTile.objects.get(insight_id=insight_id, dashboard_id=dashboard_id)+ desktop_layout = {"x": 2, "y": 3, "w": 6, "h": 5}+ tile.layouts = {"sm": desktop_layout, "xs": {"x": 0, "y": 3, "w": 1, "h": 5}}+ tile.save()++ self.dashboard_api.update_dashboard(+ dashboard_id,+ {"tiles": [{"id": tile.id, "layouts": {"xs": {"x": 0, "y": 8, "w": 1, "h": 4}}}]},+ )++ tile.refresh_from_db()+ assert tile.layouts == {"sm": desktop_layout, "xs": {"x": 0, "y": 8, "w": 1, "h": 4}}+def test_layout_patch_succeeds_on_dashboard_with_mixed_tile_state(self):"""Coverage for layout edits on a dashboard with a realistic mix of tile states:@@ -1512,7 +1550,7 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):}new_layouts = {"sm": new_sm}layouts_payload.append({"id": tile["id"], "layouts": new_layouts})- expected_layouts_by_tile_id[tile["id"]] = new_layouts+ expected_layouts_by_tile_id[tile["id"]] = {"sm": {key: new_sm[key] for key in ("x", "y", "w", "h")}}response = self.client.patch(f"/api/projects/{self.team.id}/dashboards/{dashboard_id}",@@ -1537,7 +1575,7 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):("tile_id_does_not_exist_anywhere",),])- def test_layout_patch_silently_skips_unknown_tile_id(self, scenario: str) -> None:+ def test_layout_patch_rejects_unknown_tile_id(self, scenario: str) -> None:"""Regression: the layout-only branch of ``_update_tiles`` was using ``update_or_create``,which silently fell through to INSERT when the (id, dashboard) pair didn't match an@@ -1549,7 +1587,7 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):the frontend posts a tile id that exists, but on a different dashboard.- ``tile_id_does_not_exist_anywhere``: the tile was hard-deleted or never existed.- In both cases the bad id must be silently skipped while the rest of the payload saves.+ In both cases the API must reject the full patch before it changes the valid tile."""dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "target"})valid_insight, _ = self.dashboard_api.create_insight({"dashboards": [dashboard_id], "name": "valid"})@@ -1581,10 +1619,10 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):},format="json",)- assert response.status_code == status.HTTP_200_OK, response.content[:500]+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content[:500]valid_tile.refresh_from_db()- assert valid_tile.layouts == new_layouts, "valid tile layouts should have been saved"+ assert valid_tile.layouts == {}, "valid tile layouts should not change when another tile ID is invalid"if stranger_tile is not None:stranger_tile.refresh_from_db()@@ -4210,46 +4248,56 @@ class TestDashboard(APIBaseTest, QueryMatchingTest):[("two_column",- {"x": 0, "y": 0, "w": 6, "h": 5},- {"x": 6, "y": 0, "w": 6, "h": 5},+ [+ {"x": 0, "y": 0, "w": 6, "h": 5},+ {"x": 6, "y": 0, "w": 6, "h": 5},+ {"x": 0, "y": 5, "w": 6, "h": 5},+ {"x": 6, "y": 5, "w": 6, "h": 5},+ ],+ ),+ (+ "three_column",+ [+ {"x": 0, "y": 0, "w": 4, "h": 5},+ {"x": 4, "y": 0, "w": 4, "h": 5},+ {"x": 8, "y": 0, "w": 4, "h": 5},+ {"x": 0, "y": 5, "w": 4, "h": 5},+ ],),("full_width",- {"x": 0, "y": 0, "w": 12, "h": 5},- {"x": 0, "y": 5, "w": 12, "h": 5},+ [+ {"x": 0, "y": 0, "w": 12, "h": 5},+ {"x": 0, "y": 5, "w": 12, "h": 5},+ {"x": 0, "y": 10, "w": 12, "h": 5},+ {"x": 0, "y": 15, "w": 12, "h": 5},+ ],),])- def test_reorder_tiles_layout_mode_overrides_existing_widths(- self, layout_mode: str, expected_first: dict, expected_second: dict- ):+ def test_reorder_tiles_layout_mode_overrides_existing_widths(self, layout_mode: str, expected_layouts: list[dict]):dashboard = Dashboard.objects.create(team=self.team, name="Test Dashboard")- insight1 = Insight.objects.create(team=self.team, name="Insight 1")- insight2 = Insight.objects.create(team=self.team, name="Insight 2")- tile1 = DashboardTile.objects.create(- dashboard=dashboard,- insight=insight1,- layouts={"sm": {"x": 0, "y": 0, "w": 4, "h": 8}},- )- tile2 = DashboardTile.objects.create(- dashboard=dashboard,- insight=insight2,- layouts={"sm": {"x": 4, "y": 0, "w": 4, "h": 8}},- )+ # Four tiles so the row the mode wraps on is observable, not just the first row+ tiles = [+ DashboardTile.objects.create(+ dashboard=dashboard,+ insight=Insight.objects.create(team=self.team, name=f"Insight {index}"),+ layouts={"sm": {"x": (index * 4) % 12, "y": 0, "w": 4, "h": 8}},+ )+ for index in range(4)+ ]response = self.client.post(f"/api/environments/{self.team.pk}/dashboards/{dashboard.pk}/reorder_tiles/",- {"tile_order": [tile1.pk, tile2.pk], "layout": layout_mode},+ {"tile_order": [tile.pk for tile in tiles], "layout": layout_mode},content_type="application/json",)self.assertEqual(response.status_code, status.HTTP_200_OK)- tile1.refresh_from_db()- tile2.refresh_from_db()- self.assertEqual(tile1.layouts["sm"], expected_first)- self.assertEqual(tile2.layouts["sm"], expected_second)- self.assertEqual(tile1.layouts["xs"]["w"], 1)- self.assertEqual(tile2.layouts["xs"]["w"], 1)+ for tile, expected in zip(tiles, expected_layouts):+ tile.refresh_from_db()+ self.assertEqual(tile.layouts["sm"], expected)+ self.assertEqual(tile.layouts["xs"]["w"], 1)def test_reorder_tiles_invalid_layout_returns_400(self):dashboard = Dashboard.objects.create(team=self.team, name="Test Dashboard")diff --git a/posthog/api/test/dashboards/test_dashboard_button_tiles.py b/posthog/api/test/dashboards/test_dashboard_button_tiles.pyindex c7daf5e25cf5..aa26dd2dfcbb 100644--- a/posthog/api/test/dashboards/test_dashboard_button_tiles.py+++ b/posthog/api/test/dashboards/test_dashboard_button_tiles.py@@ -167,7 +167,7 @@ class TestDashboardButtonTiles(APIBaseTest):@override_settings(IN_UNIT_TESTING=True)def test_can_duplicate_button_tile_via_dashboard_duplication(self) -> None:dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "dashboard"})- self.dashboard_api.create_button_tile(dashboard_id, url="https://example.com", text="Click")+ _, dashboard_json = self.dashboard_api.create_button_tile(dashboard_id, url="https://example.com", text="Click")new_dashboard_id, new_dashboard_json = self.dashboard_api.create_dashboard({"name": "duplicated", "use_dashboard": dashboard_id}@@ -176,4 +176,5 @@ class TestDashboardButtonTiles(APIBaseTest):assert len(new_dashboard_json["tiles"]) == 1assert new_dashboard_json["tiles"][0]["button_tile"]["url"] == "https://example.com"assert new_dashboard_json["tiles"][0]["button_tile"]["text"] == "Click"- assert new_dashboard_json["tiles"][0]["id"] != dashboard_id+ assert new_dashboard_id != dashboard_id+ assert new_dashboard_json["tiles"][0]["id"] != dashboard_json["tiles"][0]["id"]diff --git a/posthog/api/test/dashboards/test_dashboard_duplication.py b/posthog/api/test/dashboards/test_dashboard_duplication.pyindex 29f4d2f2af47..2b4358521cca 100644--- a/posthog/api/test/dashboards/test_dashboard_duplication.py+++ b/posthog/api/test/dashboards/test_dashboard_duplication.py@@ -17,7 +17,7 @@ class TestDashboardDuplication(APIBaseTest, QueryMatchingTest):super().setUp()self.dashboard_api = DashboardAPI(self.client, self.team, self.assertEqual)- self.tile_layout = {"tile_layout": "here"}+ self.tile_layout = {"sm": {"x": 0, "y": 0, "w": 6, "h": 5}}self.tile_color = "red"dashboard_id, _ = self.dashboard_api.create_dashboard({})diff --git a/products/dashboards/backend/api/dashboard.py b/products/dashboards/backend/api/dashboard.pyindex fe7eb91f77cc..32d499bc7a88 100644--- a/products/dashboards/backend/api/dashboard.py+++ b/products/dashboards/backend/api/dashboard.py@@ -445,12 +445,21 @@ def serialize_tile_with_context(tile, order: int, context: dict) -> tuple[int, dclass ReorderLayout(StrEnum):PRESERVE = "preserve"TWO_COLUMN = "two_column"+ THREE_COLUMN = "three_column"FULL_WIDTH = "full_width"DEFAULT_REORDER_TILE_WIDTH = 6DEFAULT_REORDER_TILE_HEIGHT = 5+# Tiles per row each fixed-grid mode forces. Every count divides DASHBOARD_GRID_COLUMN_COUNT, so all+# tiles get the same width and none straddles the right edge of the grid.+REORDER_LAYOUT_TILES_PER_ROW = {+ ReorderLayout.TWO_COLUMN: 2,+ ReorderLayout.THREE_COLUMN: 3,+ ReorderLayout.FULL_WIDTH: 1,+}+@frozenclass TileSize:@@ -479,29 +488,22 @@ def _apply_reorder_layout() -> None:"""Repack tiles. ``preserve`` keeps each tile's existing w/h and reuses the lowest-segmentgreedy algorithm from ``frontend/src/scenes/dashboard/tileLayouts.ts``; the other modes overwrite w/h."""- if layout_mode == ReorderLayout.TWO_COLUMN:+ tiles_per_row = REORDER_LAYOUT_TILES_PER_ROW.get(layout_mode)+ if tiles_per_row is not None:+ tile_width = DASHBOARD_GRID_COLUMN_COUNT // tiles_per_rowfor index, tile_id in enumerate(tile_order):- row, col = divmod(index, 2)+ row, col = divmod(index, tiles_per_row)tile_map[tile_id].layouts = {"sm": {- "x": col * DEFAULT_REORDER_TILE_WIDTH,+ "x": col * tile_width,"y": row * DEFAULT_REORDER_TILE_HEIGHT,- "w": DEFAULT_REORDER_TILE_WIDTH,+ "w": tile_width,"h": DEFAULT_REORDER_TILE_HEIGHT,},"xs": {"x": 0, "y": index * DEFAULT_REORDER_TILE_HEIGHT, "w": 1, "h": DEFAULT_REORDER_TILE_HEIGHT},}return- if layout_mode == ReorderLayout.FULL_WIDTH:- for index, tile_id in enumerate(tile_order):- y = index * DEFAULT_REORDER_TILE_HEIGHT- tile_map[tile_id].layouts = {- "sm": {"x": 0, "y": y, "w": DASHBOARD_GRID_COLUMN_COUNT, "h": DEFAULT_REORDER_TILE_HEIGHT},- "xs": {"x": 0, "y": y, "w": 1, "h": DEFAULT_REORDER_TILE_HEIGHT},- }- return-column_heights = [0] * DASHBOARD_GRID_COLUMN_COUNTxs_y = 0for tile_id in tile_order:@@ -541,8 +543,9 @@ class ReorderTilesRequestSerializer(serializers.Serializer):required=False,help_text=("How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height "- "and only repacks positions in the new order. 'two_column' forces a 6-wide × 5-tall grid (two tiles per "- "row). 'full_width' forces each tile to span the full 12-column row at height 5."+ "and only repacks positions in the new order. Use the other modes only when every tile should use the "+ "same size: 'two_column' makes every tile 6-wide × 5-tall, 'three_column' makes every tile 4-wide × "+ "5-tall, and 'full_width' makes every tile 12-wide × 5-tall."),)@@ -556,7 +559,8 @@ class TileLayoutBoxSerializer(serializers.Serializer):x = serializers.IntegerField(required=False, help_text="Column position in the dashboard grid (0-indexed).")y = serializers.IntegerField(required=False, help_text="Row position in the dashboard grid (0-indexed).")w = serializers.IntegerField(- required=False, help_text="Width in grid columns. The desktop grid is 12 columns wide."+ required=False,+ help_text="Width in grid columns. The desktop grid is 12 columns wide.",)h = serializers.IntegerField(required=False, help_text="Height in grid rows.")@@ -572,6 +576,37 @@ class TileLayoutsSerializer(serializers.Serializer):)+class DashboardPatchTileLayoutBoxSerializer(TileLayoutBoxSerializer):+ x = serializers.IntegerField(+ min_value=0,+ max_value=DASHBOARD_GRID_COLUMN_COUNT - 1,+ help_text="Column position in the dashboard grid (0-indexed).",+ )+ y = serializers.IntegerField(min_value=0, help_text="Row position in the dashboard grid (0-indexed).")+ w = serializers.IntegerField(+ min_value=1,+ max_value=DASHBOARD_GRID_COLUMN_COUNT,+ help_text="Width in grid columns. The desktop grid is 12 columns wide.",+ )+ h = serializers.IntegerField(min_value=1, help_text="Height in grid rows.")++ def validate(self, attrs: dict[str, int]) -> dict[str, int]:+ if attrs["x"] + attrs["w"] > DASHBOARD_GRID_COLUMN_COUNT:+ raise serializers.ValidationError("The tile must fit within the 12-column dashboard grid.")+ return attrs+++class DashboardPatchTileLayoutsSerializer(serializers.Serializer):+ sm = DashboardPatchTileLayoutBoxSerializer(+ required=False,+ help_text="Layout for the standard desktop breakpoint. The grid is 12 columns wide.",+ )+ xs = TileLayoutBoxSerializer(+ required=False,+ help_text="Optional layout for the small breakpoint.",+ )++class CreateTextTileRequestSerializer(serializers.Serializer):type = serializers.ChoiceField(choices=["text", "image"],@@ -1886,6 +1921,8 @@ class DashboardSerializer(DashboardMetadataSerializer):raise serializers.ValidationError("Variables must be a dictionary")instance.variables = request_variables+ self._validate_display_only_tile_ids(instance, initial_data.get("tiles", []))+instance = super().update(instance, validated_data)user = cast(User, self.context["request"].user)@@ -1970,8 +2007,15 @@ class DashboardSerializer(DashboardMetadataSerializer):}@staticmethod- def _extract_display_defaults(tile_data: dict) -> dict:+ def _extract_display_defaults(tile_data: dict, existing_layouts: dict | None = None) -> dict:defaults = {k: tile_data[k] for k in DashboardSerializer.TILE_DISPLAY_FIELDS if k in tile_data}+ if "layouts" in defaults:+ layouts_serializer = DashboardPatchTileLayoutsSerializer(data=defaults["layouts"])+ if not layouts_serializer.is_valid():+ raise serializers.ValidationError({"layouts": layouts_serializer.errors})+ defaults["layouts"] = {**(existing_layouts or {}), **layouts_serializer.validated_data}+ if layouts_serializer.validated_data and "sm" not in defaults["layouts"]:+ raise serializers.ValidationError({"layouts": {"sm": ["This field is required."]}})# `filters_overrides` is opaque JSON with the same `properties` shape ambiguity as dashboard# `filters` — normalize a PropertyGroupFilter dict on `properties` to the flat-list contract so# a malformed tile override can't be persisted for the merge/contradiction code to trip on.@@ -1981,6 +2025,29 @@ class DashboardSerializer(DashboardMetadataSerializer):defaults["filters_overrides"] = DashboardSerializer._validated_filters(tile_filters)return defaults+ @staticmethod+ def _validate_display_only_tile_ids(instance: Dashboard, tiles: list[dict]) -> None:+ tile_ids = {+ tile["id"]+ for tile in tiles+ if tile.get("id") is not None+ and not tile.get("text")+ and not tile.get("button_tile")+ and not tile.get("widget")+ and any(field in tile for field in DashboardSerializer.TILE_DISPLAY_FIELDS)+ }+ if not tile_ids:+ return++ found_tile_ids = set(+ DashboardTile.objects_including_soft_deleted.filter(id__in=tile_ids, dashboard=instance).values_list(+ "id", flat=True+ )+ )+ missing_tile_ids = sorted(tile_ids - found_tile_ids)+ if missing_tile_ids:+ raise serializers.ValidationError({"tiles": f"Tile IDs not found on this dashboard: {missing_tile_ids}."})+@staticmethoddef _widget_tile_validation_error(exc: serializers.ValidationError) -> serializers.ValidationError:detail = exc.detail@@ -2061,12 +2128,11 @@ class DashboardSerializer(DashboardMetadataSerializer):def _update_existing_tile_display_fields(instance: Dashboard, tile_data: dict, user: User) -> tuple[DashboardTile | None, bool]:- """Update display fields on an existing tile, or skip silently if the id is unknown.+ """Update display fields on an existing tile.A display-only payload carries no insight/text/button_tile FK, so it cannot satisfythe ``dash_tile_exactly_one_related_object`` CHECK constraint if it falls through to- an INSERT. ``update_or_create`` here used to 500 whenever the frontend posted a stale- tile id (cross-dashboard contamination, hard-deleted tiles, races). Never INSERT here.+ an INSERT. Never INSERT here.Returns the updated tile and whether this payload transitioned it to soft-deleted."""@@ -2074,21 +2140,14 @@ class DashboardSerializer(DashboardMetadataSerializer):if tile_id is None:return None, False- tile_defaults = DashboardSerializer._extract_display_defaults(tile_data)- if not tile_defaults:- return None, False-existing = DashboardTile.objects_including_soft_deleted.filter(id=tile_id, dashboard=instance, dashboard__team_id=instance.team_id).first()if existing is None:- logger.warning(- "dashboard_layout_patch_unknown_tile_skipped",- team_id=instance.team_id,- dashboard_id=instance.id,- tile_id=tile_id,- payload_fields=sorted(tile_defaults.keys()),- )+ raise serializers.ValidationError({"tiles": f"Tile ID {tile_id} is not on this dashboard."})++ tile_defaults = DashboardSerializer._extract_display_defaults(tile_data, existing.layouts)+ if not tile_defaults:return None, Falsebecame_deleted = bool(tile_defaults.get("deleted")) and not existing.deleteddiff --git a/products/dashboards/backend/api/test/test_dashboard_openapi.py b/products/dashboards/backend/api/test/test_dashboard_openapi.pyindex 9a320aad3600..fce0d4a17a99 100644--- a/products/dashboards/backend/api/test/test_dashboard_openapi.py+++ b/products/dashboards/backend/api/test/test_dashboard_openapi.py@@ -41,6 +41,35 @@ class TestDashboardPatchOpenApiContract:f"Missing: {sorted(missing)}.")+ def test_tile_layouts_documented_as_writable_patch_field(self) -> None:+ tiles_field = PatchedDashboardOpenApiSerializer().fields["tiles"]+ assert isinstance(tiles_field, serializers.ListSerializer)+ tile_serializer = tiles_field.child+ assert isinstance(tile_serializer, serializers.Serializer)+ tile_fields = tile_serializer.fields+ assert "layouts" in tile_fields, (+ "DashboardPatchTileOpenApiSerializer must document 'layouts' so the dashboard-update MCP tool can "+ f"set a tile's grid position and size. Got: {sorted(tile_fields)}."+ )+ layouts_field = tile_fields["layouts"]+ assert isinstance(layouts_field, serializers.Serializer)+ breakpoints = layouts_field.fields+ assert {"sm", "xs"}.issubset(breakpoints), f"Tile layouts must expose sm/xs. Got: {sorted(breakpoints)}."+ sm_field = breakpoints["sm"]+ assert sm_field.required, (+ "Tile layouts must require 'sm'. A write replaces the tile's whole layouts value, so a payload "+ "carrying only 'xs' erases the desktop placement the dashboard renders from."+ )+ assert isinstance(sm_field, serializers.Serializer)+ assert {"x", "y", "w", "h"}.issubset(sm_field.fields), (+ f"Tile layout box must expose x/y/w/h. Got: {sorted(sm_field.fields)}."+ )+ optional = sorted(name for name, field in sm_field.fields.items() if not field.required)+ assert not optional, (+ "Every tile layout box field must be required, because a write replaces the tile's whole "+ f"layouts value instead of merging into it. Optional: {optional}."+ )+def test_filters_documented_as_writable_patch_field(self) -> None:# filters is a SerializerMethodField on DashboardSerializer (read-only in the inferred schema),# so it is excluded from dashboard_patch_runtime_openapi_field_names(). The PATCH runtime accepts anddiff --git a/products/dashboards/backend/widget_specs/openapi.py b/products/dashboards/backend/widget_specs/openapi.pyindex 7acb94fec8cc..61e26c88dee5 100644--- a/products/dashboards/backend/widget_specs/openapi.py+++ b/products/dashboards/backend/widget_specs/openapi.py@@ -6,6 +6,7 @@ from drf_spectacular.utils import PolymorphicProxySerializer, extend_schema_fielfrom pydantic import BaseModelfrom rest_framework import serializers+from products.dashboards.backend.constants import DASHBOARD_GRID_COLUMN_COUNTfrom products.dashboards.backend.facade.enums import RestrictionLevelfrom products.dashboards.backend.models.dashboard import DASHBOARD_GRID_COMPACTION_MODES, DASHBOARD_GRID_SPACING_GAPSfrom products.dashboards.backend.widget_specs.pydantic_openapi import pydantic_config_field, pydantic_stub_serializer@@ -27,7 +28,7 @@ def _config_model_openapi_prefix(config_model: type[BaseModel]) -> str:return name-class _WidgetTileLayoutBoxOpenApiSerializer(serializers.Serializer):+class _TileLayoutBoxOpenApiSerializer(serializers.Serializer):x = serializers.IntegerField(required=False,help_text="Column position in the dashboard grid (0-indexed).",@@ -43,14 +44,49 @@ class _WidgetTileLayoutBoxOpenApiSerializer(serializers.Serializer):h = serializers.IntegerField(required=False, help_text="Height in grid rows.")-class _WidgetTileLayoutsOpenApiSerializer(serializers.Serializer):- sm = _WidgetTileLayoutBoxOpenApiSerializer(+class _TileLayoutsOpenApiSerializer(serializers.Serializer):+ sm = _TileLayoutBoxOpenApiSerializer(required=False,help_text="Layout for the standard (desktop) breakpoint. The grid is 12 columns wide.",)- xs = _WidgetTileLayoutBoxOpenApiSerializer(+ xs = _TileLayoutBoxOpenApiSerializer(required=False,- help_text="Layout for the small (mobile) breakpoint. The grid is 1 column wide.",+ help_text=(+ "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout "+ "from the sm order and heights, so a stored xs box does not change what renders."+ ),+ )+++class _DashboardPatchTileLayoutBoxOpenApiSerializer(serializers.Serializer):+ x = serializers.IntegerField(+ min_value=0,+ max_value=DASHBOARD_GRID_COLUMN_COUNT - 1,+ help_text="Column position in the dashboard grid (0-indexed).",+ )+ y = serializers.IntegerField(min_value=0, help_text="Row position in the dashboard grid (0-indexed).")+ w = serializers.IntegerField(+ min_value=1,+ max_value=DASHBOARD_GRID_COLUMN_COUNT,+ help_text="Width in grid columns. The desktop grid is 12 columns wide.",+ )+ h = serializers.IntegerField(min_value=1, help_text="Height in grid rows.")+++class _DashboardPatchTileLayoutsOpenApiSerializer(serializers.Serializer):+ sm = _DashboardPatchTileLayoutBoxOpenApiSerializer(+ help_text=(+ "Layout for the standard (desktop) breakpoint. The grid is 12 columns wide. A write replaces the "+ "tile's whole layout and the dashboard reads desktop placement from this box, so send it whenever "+ "you send layouts."+ ),+ )+ xs = _DashboardPatchTileLayoutBoxOpenApiSerializer(+ required=False,+ help_text=(+ "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout "+ "from the sm order and heights, so a stored xs box does not change what renders."+ ),)@@ -67,7 +103,7 @@ class _AddDashboardWidgetTileFieldsOpenApiSerializer(serializers.Serializer):allow_blank=True,help_text="Optional markdown description shown when show_description is enabled.",)- layouts = _WidgetTileLayoutsOpenApiSerializer(+ layouts = _TileLayoutsOpenApiSerializer(required=False,help_text="Optional react-grid-layout positions keyed by breakpoint (sm, xs).",)@@ -246,6 +282,15 @@ class DashboardPatchWidgetOpenApiSerializer(serializers.Serializer):class DashboardPatchTileOpenApiSerializer(serializers.Serializer):id = serializers.IntegerField(required=False, help_text="Dashboard tile ID to update.")+ layouts = _DashboardPatchTileLayoutsOpenApiSerializer(+ required=False,+ help_text=(+ "Grid position and size per breakpoint. Works for every tile type, including insight tiles. "+ "A write replaces the tile's whole layout, so send a complete sm box rather than the one value "+ "you want to change. Boxes are stored as sent and overlaps are not resolved, so send sm boxes "+ "that do not overlap, and include every tile you move in the same request."+ ),+ )widget = DashboardPatchWidgetOpenApiSerializer(required=False, help_text="Nested widget row updates.")@@ -378,7 +423,10 @@ class PatchedDashboardOpenApiSerializer(serializers.Serializer):tiles = DashboardPatchTileOpenApiSerializer(many=True,required=False,- help_text="Dashboard tiles to update. Widget tiles accept nested widget.config patches.",+ help_text=(+ "Dashboard tiles to update, each identified by its tile id. Any tile type accepts `layouts` to set "+ "its grid position and size. Widget tiles also accept nested widget.config patches."+ ),)use_template = serializers.CharField(required=False,diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.tsindex 11884db012fb..dde07aadabd9 100644--- a/products/dashboards/frontend/generated/api.schemas.ts+++ b/products/dashboards/frontend/generated/api.schemas.ts@@ -640,6 +640,38 @@ export interface DashboardFiltersOpenApiApi {properties?: unknown}+export interface _DashboardPatchTileLayoutBoxOpenApiApi {+ /**+ * Column position in the dashboard grid (0-indexed).+ * @minimum 0+ * @maximum 11+ */+ x: number+ /**+ * Row position in the dashboard grid (0-indexed).+ * @minimum 0+ */+ y: number+ /**+ * Width in grid columns. The desktop grid is 12 columns wide.+ * @minimum 1+ * @maximum 12+ */+ w: number+ /**+ * Height in grid rows.+ * @minimum 1+ */+ h: number+}++export interface _DashboardPatchTileLayoutsOpenApiApi {+ /** Layout for the standard (desktop) breakpoint. The grid is 12 columns wide. A write replaces the tile's whole layout and the dashboard reads desktop placement from this box, so send it whenever you send layouts. */+ sm: _DashboardPatchTileLayoutBoxOpenApiApi+ /** Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders. */+ xs?: _DashboardPatchTileLayoutBoxOpenApiApi+}+/*** * `activity_events_list` - activity_events_list* * `conversations_recent_tickets` - conversations_recent_tickets@@ -1133,6 +1165,8 @@ export interface DashboardPatchWidgetOpenApiApi {export interface DashboardPatchTileOpenApiApi {/** Dashboard tile ID to update. */id?: number+ /** Grid position and size per breakpoint. Works for every tile type, including insight tiles. A write replaces the tile's whole layout, so send a complete sm box rather than the one value you want to change. Boxes are stored as sent and overlaps are not resolved, so send sm boxes that do not overlap, and include every tile you move in the same request. */+ layouts?: _DashboardPatchTileLayoutsOpenApiApi/** Nested widget row updates. */widget?: DashboardPatchWidgetOpenApiApi}@@ -1188,7 +1222,7 @@ export interface PatchedPatchedDashboardOpenApiApi {* * `horizontal` - horizontal* * `stable` - stable */layout_compaction?: LayoutCompactionEnumApi- /** Dashboard tiles to update. Widget tiles accept nested widget.config patches. */+ /** Dashboard tiles to update, each identified by its tile id. Any tile type accepts `layouts` to set its grid position and size. Widget tiles also accept nested widget.config patches. */tiles?: DashboardPatchTileOpenApiApi[]/** Template key to create the dashboard from a predefined template. */use_template?: string@@ -9549,6 +9583,7 @@ export interface PatchedMoveTileRequestApi {/*** * `preserve` - preserve* * `two_column` - two_column+ * * `three_column` - three_column* * `full_width` - full_width*/export type LayoutEnumApi = (typeof LayoutEnumApi)[keyof typeof LayoutEnumApi]@@ -9556,6 +9591,7 @@ export type LayoutEnumApi = (typeof LayoutEnumApi)[keyof typeof LayoutEnumApi]export const LayoutEnumApi = {Preserve: 'preserve',TwoColumn: 'two_column',+ ThreeColumn: 'three_column',FullWidth: 'full_width',} as const@@ -9565,10 +9601,11 @@ export interface ReorderTilesRequestApi {* @minItems 1*/tile_order: number[]- /** How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height and only repacks positions in the new order. 'two_column' forces a 6-wide × 5-tall grid (two tiles per row). 'full_width' forces each tile to span the full 12-column row at height 5.+ /** How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height and only repacks positions in the new order. Use the other modes only when every tile should use the same size: 'two_column' makes every tile 6-wide × 5-tall, 'three_column' makes every tile 4-wide × 5-tall, and 'full_width' makes every tile 12-wide × 5-tall.** * `preserve` - preserve* * `two_column` - two_column+ * * `three_column` - three_column* * `full_width` - full_width */layout?: LayoutEnumApi}@@ -9645,7 +9682,7 @@ export interface UpdateTextTileRequestApi {color?: string | null}-export interface _WidgetTileLayoutBoxOpenApiApi {+export interface _TileLayoutBoxOpenApiApi {/** Column position in the dashboard grid (0-indexed). */x?: number/** Row position in the dashboard grid (0-indexed). */@@ -9656,11 +9693,11 @@ export interface _WidgetTileLayoutBoxOpenApiApi {h?: number}-export interface _WidgetTileLayoutsOpenApiApi {+export interface _TileLayoutsOpenApiApi {/** Layout for the standard (desktop) breakpoint. The grid is 12 columns wide. */- sm?: _WidgetTileLayoutBoxOpenApiApi- /** Layout for the small (mobile) breakpoint. The grid is 1 column wide. */- xs?: _WidgetTileLayoutBoxOpenApiApi+ sm?: _TileLayoutBoxOpenApiApi+ /** Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders. */+ xs?: _TileLayoutBoxOpenApiApi}export type ActivityEventsListWidgetAddRequestOpenApiApiWidgetType =@@ -9680,7 +9717,7 @@ export interface ActivityEventsListWidgetAddRequestOpenApiApi {/** Optional markdown description shown when show_description is enabled. */description?: string/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApiApi+ layouts?: _TileLayoutsOpenApiApi/** Whether to show the description on the dashboard tile. */show_description?: booleanwidget_type: ActivityEventsListWidgetAddRequestOpenApiApiWidgetType@@ -9705,7 +9742,7 @@ export interface ErrorTrackingListWidgetAddRequestOpenApiApi {/** Optional markdown description shown when show_description is enabled. */description?: string/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApiApi+ layouts?: _TileLayoutsOpenApiApi/** Whether to show the description on the dashboard tile. */show_description?: booleanwidget_type: ErrorTrackingListWidgetAddRequestOpenApiApiWidgetType@@ -9730,7 +9767,7 @@ export interface SessionReplayListWidgetAddRequestOpenApiApi {/** Optional markdown description shown when show_description is enabled. */description?: string/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApiApi+ layouts?: _TileLayoutsOpenApiApi/** Whether to show the description on the dashboard tile. */show_description?: booleanwidget_type: SessionReplayListWidgetAddRequestOpenApiApiWidgetType@@ -9755,7 +9792,7 @@ export interface ExperimentsListWidgetAddRequestOpenApiApi {/** Optional markdown description shown when show_description is enabled. */description?: string/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApiApi+ layouts?: _TileLayoutsOpenApiApi/** Whether to show the description on the dashboard tile. */show_description?: booleanwidget_type: ExperimentsListWidgetAddRequestOpenApiApiWidgetType@@ -9780,7 +9817,7 @@ export interface ExperimentResultsWidgetAddRequestOpenApiApi {/** Optional markdown description shown when show_description is enabled. */description?: string/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApiApi+ layouts?: _TileLayoutsOpenApiApi/** Whether to show the description on the dashboard tile. */show_description?: booleanwidget_type: ExperimentResultsWidgetAddRequestOpenApiApiWidgetType@@ -9805,7 +9842,7 @@ export interface SurveyResultsWidgetAddRequestOpenApiApi {/** Optional markdown description shown when show_description is enabled. */description?: string/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApiApi+ layouts?: _TileLayoutsOpenApiApi/** Whether to show the description on the dashboard tile. */show_description?: booleanwidget_type: SurveyResultsWidgetAddRequestOpenApiApiWidgetType@@ -9830,7 +9867,7 @@ export interface LogsListWidgetAddRequestOpenApiApi {/** Optional markdown description shown when show_description is enabled. */description?: string/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApiApi+ layouts?: _TileLayoutsOpenApiApi/** Whether to show the description on the dashboard tile. */show_description?: booleanwidget_type: LogsListWidgetAddRequestOpenApiApiWidgetType@@ -9855,7 +9892,7 @@ export interface ConversationsRecentTicketsWidgetAddRequestOpenApiApi {/** Optional markdown description shown when show_description is enabled. */description?: string/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApiApi+ layouts?: _TileLayoutsOpenApiApi/** Whether to show the description on the dashboard tile. */show_description?: booleanwidget_type: ConversationsRecentTicketsWidgetAddRequestOpenApiApiWidgetTypediff --git a/products/dashboards/frontend/generated/api.zod.ts b/products/dashboards/frontend/generated/api.zod.tsindex 1b3651ec8873..e4875accbc37 100644--- a/products/dashboards/frontend/generated/api.zod.ts+++ b/products/dashboards/frontend/generated/api.zod.ts@@ -469,6 +469,19 @@ export const DashboardsUpdateBody = /* @__PURE__ */ zodexport const dashboardsPartialUpdateBodyNameMax = 400export const dashboardsPartialUpdateBodyBreakdownColorsItemColorTokenRegExp = new RegExp('^preset-[1-9][0-9]\*$')+export const dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneXMin = 0+export const dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneXMax = 11++export const dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneYMin = 0++export const dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneWMax = 12++export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneXMin = 0+export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneXMax = 11++export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneYMin = 0++export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneWMax = 12export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitDefault = 25export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitMax = 50@@ -636,6 +649,56 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod.array(zod.object({id: zod.number().optional().describe('Dashboard tile ID to update.'),+ layouts: zod+ .object({+ sm: zod+ .object({+ x: zod+ .number()+ .min(dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneXMin)+ .max(dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneXMax)+ .describe('Column position in the dashboard grid (0-indexed).'),+ y: zod+ .number()+ .min(dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneYMin)+ .describe('Row position in the dashboard grid (0-indexed).'),+ w: zod+ .number()+ .min(1)+ .max(dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneWMax)+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),+ h: zod.number().min(1).describe('Height in grid rows.'),+ })+ .describe(+ "Layout for the standard (desktop) breakpoint. The grid is 12 columns wide. A write replaces the tile's whole layout and the dashboard reads desktop placement from this box, so send it whenever you send layouts."+ ),+ xs: zod+ .object({+ x: zod+ .number()+ .min(dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneXMin)+ .max(dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneXMax)+ .describe('Column position in the dashboard grid (0-indexed).'),+ y: zod+ .number()+ .min(dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneYMin)+ .describe('Row position in the dashboard grid (0-indexed).'),+ w: zod+ .number()+ .min(1)+ .max(dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneWMax)+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),+ h: zod.number().min(1).describe('Height in grid rows.'),+ })+ .optional()+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),+ })+ .optional()+ .describe(+ "Grid position and size per breakpoint. Works for every tile type, including insight tiles. A write replaces the tile's whole layout, so send a complete sm box rather than the one value you want to change. Boxes are stored as sent and overlaps are not resolved, so send sm boxes that do not overlap, and include every tile you move in the same request."+ ),widget: zod.object({id: zod@@ -1342,7 +1405,9 @@ export const DashboardsPartialUpdateBody = /* @__PURE__ */ zod})).optional()- .describe('Dashboard tiles to update. Widget tiles accept nested widget.config patches.'),+ .describe(+ 'Dashboard tiles to update, each identified by its tile id. Any tile type accepts `layouts` to set its grid position and size. Widget tiles also accept nested widget.config patches.'+ ),use_template: zod.string().optional()@@ -1461,11 +1526,13 @@ export const DashboardsReorderTilesCreateBody = /* @__PURE__ */ zod.object({.min(1).describe('Array of tile IDs in the desired display order (top to bottom, left to right).'),layout: zod- .enum(['preserve', 'two_column', 'full_width'])- .describe('\* `preserve` - preserve\n\* `two_column` - two_column\n\* `full_width` - full_width')+ .enum(['preserve', 'two_column', 'three_column', 'full_width'])+ .describe(+ '\* `preserve` - preserve\n\* `two_column` - two_column\n\* `three_column` - three_column\n\* `full_width` - full_width'+ ).default(dashboardsReorderTilesCreateBodyLayoutDefault).describe(- "How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height and only repacks positions in the new order. 'two_column' forces a 6-wide × 5-tall grid (two tiles per row). 'full_width' forces each tile to span the full 12-column row at height 5.\n\n\* `preserve` - preserve\n\* `two_column` - two_column\n\* `full_width` - full_width"+ "How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height and only repacks positions in the new order. Use the other modes only when every tile should use the same size: 'two_column' makes every tile 6-wide × 5-tall, 'three_column' makes every tile 4-wide × 5-tall, and 'full_width' makes every tile 12-wide × 5-tall.\n\n\* `preserve` - preserve\n\* `two_column` - two_column\n\* `three_column` - three_column\n\* `full_width` - full_width"),})@@ -1642,7 +1709,9 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -1893,7 +1962,9 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2066,7 +2137,9 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2244,7 +2317,9 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2331,7 +2406,9 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2400,7 +2477,9 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2499,7 +2578,9 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2617,7 +2698,9 @@ export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),diff --git a/products/dashboards/mcp/tools.yaml b/products/dashboards/mcp/tools.yamlindex 83e774a7b6ea..bb79e780664e 100644--- a/products/dashboards/mcp/tools.yaml+++ b/products/dashboards/mcp/tools.yaml@@ -308,8 +308,10 @@ tools:title: Reorder dashboard tilesdescription: >Reorder tiles on a dashboard by providing an array of tile IDs in the desired display order. First, use- dashboard-get to see current tile IDs. By default existing tile widths and heights are preserved; see the- layout parameter to force a 2-column or full-width grid instead.+ dashboard-get to see current tile IDs. By default existing tile widths and heights are preserved. Use the+ layout parameter only when every tile should use the same size: `two_column` makes every tile 6-wide,+ `three_column` makes every tile 4-wide, and `full_width` makes every tile 12-wide. For a mixed layout, set+ each tile's `layouts` with dashboard-update instead.dashboard-saved-views-create:operation: dashboard_saved_views_createenabled: false@@ -421,12 +423,20 @@ tools:title: Update dashboarddescription: >Update an existing dashboard by ID. Can update name, description, pinned status, tags, filters, and- restriction level, and widget tile placement (layouts, show_description). To change a widget's own settings- (config, name, description), prefer dashboard-widgets-batch-update, which takes just a tile_id per widget.- You can also update widget tiles here by passing `tiles` with each tile's `id` and nested `widget.id` plus- fields to change (`config`, `name`, `description`) from dashboard-get — the same PATCH path the UI uses. To- add new widget tiles to this dashboard, use dashboard-widgets-batch-add instead. The returned tiles omit- insight results to save context — use dashboard-insights-run to fetch the actual data for each insight.+ restriction level. To resize or move tiles, pass `tiles` with each tile's `id` from dashboard-get and a+ `layouts` object holding x, y, w, and h per breakpoint. This works for every tile type, insight tiles+ included. The desktop grid (`layouts.sm`) is 12 columns wide. Set each tile's width and height for its+ content and importance. Width can be any whole number from 1 to 12, subject to the tile's minimum size.+ Mixed rows such as 8-wide and 4-wide tiles can show hierarchy. A write replaces the tile's whole layout, so+ send a complete box, not just the value you want to change. Boxes are stored as sent and overlaps are not+ resolved, so plan the whole grid and send every tile you move in one request. Only set `layouts.sm`: the+ dashboard derives the mobile layout from the sm order and heights. Use dashboard-reorder-tiles only for a+ whole-dashboard repack where every tile should use the same size. The same `tiles` array also updates a+ widget tile's own settings: add a nested `widget.id` from dashboard-get plus the fields to change (`config`,+ `name`, `description`). That is the same PATCH path the UI uses, but prefer dashboard-widgets-batch-update,+ which takes just a tile_id per widget. To add new widget tiles to this dashboard, use+ dashboard-widgets-batch-add instead. The returned tiles omit insight results to save context — use+ dashboard-insights-run to fetch the actual data for each insight.exclude_params:- creation_mode- effective_restriction_leveldiff --git a/products/dashboards/skills/building-a-dashboard/SKILL.md b/products/dashboards/skills/building-a-dashboard/SKILL.mdindex a2d88eb43f5c..b951211c6f73 100644--- a/products/dashboards/skills/building-a-dashboard/SKILL.md+++ b/products/dashboards/skills/building-a-dashboard/SKILL.md@@ -53,8 +53,16 @@ Prefer reusing existing insights over recreating them.- New dashboard: `dashboard-create` with a short (3–7 word) name and a concise description, then add the insight tiles.- Existing dashboard: `dashboard-update`. Adding, replacing, or removing insights means sending the full intended set oftiles — insights you omit are removed, so include the ones you want to keep.-- Layout: by default preserve existing tile placement. Only reflow (`dashboard-reorder-tiles`) when the user explicitly- asks to rearrange, reorder, or move tiles.+- Layout: by default preserve existing tile placement. Use `dashboard-update` to plan each tile independently on the+ 12-column grid. Tile widths can be any whole number from 1 to 12, subject to each tile's minimum size. Use wider+ tiles for primary charts and smaller tiles for supporting metrics. Mixed rows such as 8 plus 4 or 6 plus 6 can show+ that hierarchy.+- Reflow: use `dashboard-reorder-tiles` only when the user explicitly asks to reorder tiles or make every tile the+ same size. Its layout modes give every tile a uniform box. For mixed widths or heights, use `dashboard-update`.+- Tile sizes: send `tiles` through `dashboard-update` with each tile's `id` and one or both layout boxes. A layout update+ changes only the submitted breakpoint. For example, `layouts.xs` preserves the stored `layouts.sm` box. Send a complete+ `layouts.sm` box when a tile has no desktop placement. The API stores only `x`, `y`, `w`, and `h`. It does not resolve+ overlaps, so plan the grid before you send it.- Verify with `dashboard-insights-run` to confirm the tiles return data, then summarize what you built and invite theuser to refine it.diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 4afe66f3e752..ab702feefd90 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -2701,7 +2701,7 @@}},"dashboard-reorder-tiles": {- "description": "Reorder tiles on a dashboard by providing an array of tile IDs in the desired display order. First, use dashboard-get to see current tile IDs. By default existing tile widths and heights are preserved; see the layout parameter to force a 2-column or full-width grid instead.",+ "description": "Reorder tiles on a dashboard by providing an array of tile IDs in the desired display order. First, use dashboard-get to see current tile IDs. By default existing tile widths and heights are preserved. Use the layout parameter only when every tile should use the same size: `two_column` makes every tile 6-wide, `three_column` makes every tile 4-wide, and `full_width` makes every tile 12-wide. For a mixed layout, set each tile's `layouts` with dashboard-update instead.","category": "Dashboards","feature": "dashboards","summary": "Reorder dashboard tiles",@@ -2757,7 +2757,7 @@}},"dashboard-update": {- "description": "Update an existing dashboard by ID. Can update name, description, pinned status, tags, filters, and restriction level, and widget tile placement (layouts, show_description). To change a widget's own settings (config, name, description), prefer dashboard-widgets-batch-update, which takes just a tile_id per widget. You can also update widget tiles here by passing `tiles` with each tile's `id` and nested `widget.id` plus fields to change (`config`, `name`, `description`) from dashboard-get — the same PATCH path the UI uses. To add new widget tiles to this dashboard, use dashboard-widgets-batch-add instead. The returned tiles omit insight results to save context — use dashboard-insights-run to fetch the actual data for each insight.",+ "description": "Update an existing dashboard by ID. Can update name, description, pinned status, tags, filters, and restriction level. To resize or move tiles, pass `tiles` with each tile's `id` from dashboard-get and a `layouts` object holding x, y, w, and h per breakpoint. This works for every tile type, insight tiles included. The desktop grid (`layouts.sm`) is 12 columns wide. Set each tile's width and height for its content and importance. Width can be any whole number from 1 to 12, subject to the tile's minimum size. Mixed rows such as 8-wide and 4-wide tiles can show hierarchy. A write replaces the tile's whole layout, so send a complete box, not just the value you want to change. Boxes are stored as sent and overlaps are not resolved, so plan the whole grid and send every tile you move in one request. Only set `layouts.sm`: the dashboard derives the mobile layout from the sm order and heights. Use dashboard-reorder-tiles only for a whole-dashboard repack where every tile should use the same size. The same `tiles` array also updates a widget tile's own settings: add a nested `widget.id` from dashboard-get plus the fields to change (`config`, `name`, `description`). That is the same PATCH path the UI uses, but prefer dashboard-widgets-batch-update, which takes just a tile_id per widget. To add new widget tiles to this dashboard, use dashboard-widgets-batch-add instead. The returned tiles omit insight results to save context — use dashboard-insights-run to fetch the actual data for each insight.","category": "Dashboards","feature": "dashboards","summary": "Update dashboard",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 3de0ed25b8fb..0c5b1b38089f 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -2716,7 +2716,7 @@}},"dashboard-reorder-tiles": {- "description": "Reorder tiles on a dashboard by providing an array of tile IDs in the desired display order. First, use dashboard-get to see current tile IDs. By default existing tile widths and heights are preserved; see the layout parameter to force a 2-column or full-width grid instead.",+ "description": "Reorder tiles on a dashboard by providing an array of tile IDs in the desired display order. First, use dashboard-get to see current tile IDs. By default existing tile widths and heights are preserved. Use the layout parameter only when every tile should use the same size: `two_column` makes every tile 6-wide, `three_column` makes every tile 4-wide, and `full_width` makes every tile 12-wide. For a mixed layout, set each tile's `layouts` with dashboard-update instead.","category": "Dashboards","feature": "dashboards","summary": "Reorder dashboard tiles",@@ -2772,7 +2772,7 @@}},"dashboard-update": {- "description": "Update an existing dashboard by ID. Can update name, description, pinned status, tags, filters, and restriction level, and widget tile placement (layouts, show_description). To change a widget's own settings (config, name, description), prefer dashboard-widgets-batch-update, which takes just a tile_id per widget. You can also update widget tiles here by passing `tiles` with each tile's `id` and nested `widget.id` plus fields to change (`config`, `name`, `description`) from dashboard-get — the same PATCH path the UI uses. To add new widget tiles to this dashboard, use dashboard-widgets-batch-add instead. The returned tiles omit insight results to save context — use dashboard-insights-run to fetch the actual data for each insight.",+ "description": "Update an existing dashboard by ID. Can update name, description, pinned status, tags, filters, and restriction level. To resize or move tiles, pass `tiles` with each tile's `id` from dashboard-get and a `layouts` object holding x, y, w, and h per breakpoint. This works for every tile type, insight tiles included. The desktop grid (`layouts.sm`) is 12 columns wide. Set each tile's width and height for its content and importance. Width can be any whole number from 1 to 12, subject to the tile's minimum size. Mixed rows such as 8-wide and 4-wide tiles can show hierarchy. A write replaces the tile's whole layout, so send a complete box, not just the value you want to change. Boxes are stored as sent and overlaps are not resolved, so plan the whole grid and send every tile you move in one request. Only set `layouts.sm`: the dashboard derives the mobile layout from the sm order and heights. Use dashboard-reorder-tiles only for a whole-dashboard repack where every tile should use the same size. The same `tiles` array also updates a widget tile's own settings: add a nested `widget.id` from dashboard-get plus the fields to change (`config`, `name`, `description`). That is the same PATCH path the UI uses, but prefer dashboard-widgets-batch-update, which takes just a tile_id per widget. To add new widget tiles to this dashboard, use dashboard-widgets-batch-add instead. The returned tiles omit insight results to save context — use dashboard-insights-run to fetch the actual data for each insight.","category": "Dashboards","feature": "dashboards","summary": "Update dashboard",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex de35f3a62826..eba240222846 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -3378,7 +3378,7 @@ export namespace Schemas {ActivityEventsList: 'activity_events_list',} as const;- export interface _WidgetTileLayoutBoxOpenApi {+ export interface _TileLayoutBoxOpenApi {/** Column position in the dashboard grid (0-indexed). */x?: number;/** Row position in the dashboard grid (0-indexed). */@@ -3389,11 +3389,11 @@ export namespace Schemas {h?: number;}- export interface _WidgetTileLayoutsOpenApi {+ export interface _TileLayoutsOpenApi {/** Layout for the standard (desktop) breakpoint. The grid is 12 columns wide. */- sm?: _WidgetTileLayoutBoxOpenApi;- /** Layout for the small (mobile) breakpoint. The grid is 1 column wide. */- xs?: _WidgetTileLayoutBoxOpenApi;+ sm?: _TileLayoutBoxOpenApi;+ /** Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders. */+ xs?: _TileLayoutBoxOpenApi;}export type WidgetDateRangeDateFrom = typeof WidgetDateRangeDateFrom[keyof typeof WidgetDateRangeDateFrom] | null;@@ -3474,7 +3474,7 @@ export namespace Schemas {/** Optional markdown description shown when show_description is enabled. */description?: string;/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApi;+ layouts?: _TileLayoutsOpenApi;/** Whether to show the description on the dashboard tile. */show_description?: boolean;widget_type: ActivityEventsListWidgetAddRequestOpenApiWidgetType;@@ -6192,7 +6192,7 @@ export namespace Schemas {/** Optional markdown description shown when show_description is enabled. */description?: string;/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApi;+ layouts?: _TileLayoutsOpenApi;/** Whether to show the description on the dashboard tile. */show_description?: boolean;widget_type: ErrorTrackingListWidgetAddRequestOpenApiWidgetType;@@ -6265,7 +6265,7 @@ export namespace Schemas {/** Optional markdown description shown when show_description is enabled. */description?: string;/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApi;+ layouts?: _TileLayoutsOpenApi;/** Whether to show the description on the dashboard tile. */show_description?: boolean;widget_type: SessionReplayListWidgetAddRequestOpenApiWidgetType;@@ -6345,7 +6345,7 @@ export namespace Schemas {/** Optional markdown description shown when show_description is enabled. */description?: string;/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApi;+ layouts?: _TileLayoutsOpenApi;/** Whether to show the description on the dashboard tile. */show_description?: boolean;widget_type: ExperimentsListWidgetAddRequestOpenApiWidgetType;@@ -6375,7 +6375,7 @@ export namespace Schemas {/** Optional markdown description shown when show_description is enabled. */description?: string;/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApi;+ layouts?: _TileLayoutsOpenApi;/** Whether to show the description on the dashboard tile. */show_description?: boolean;widget_type: ExperimentResultsWidgetAddRequestOpenApiWidgetType;@@ -6413,7 +6413,7 @@ export namespace Schemas {/** Optional markdown description shown when show_description is enabled. */description?: string;/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApi;+ layouts?: _TileLayoutsOpenApi;/** Whether to show the description on the dashboard tile. */show_description?: boolean;widget_type: SurveyResultsWidgetAddRequestOpenApiWidgetType;@@ -6494,7 +6494,7 @@ export namespace Schemas {/** Optional markdown description shown when show_description is enabled. */description?: string;/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApi;+ layouts?: _TileLayoutsOpenApi;/** Whether to show the description on the dashboard tile. */show_description?: boolean;widget_type: LogsListWidgetAddRequestOpenApiWidgetType;@@ -6586,7 +6586,7 @@ export namespace Schemas {/** Optional markdown description shown when show_description is enabled. */description?: string;/** Optional react-grid-layout positions keyed by breakpoint (sm, xs). */- layouts?: _WidgetTileLayoutsOpenApi;+ layouts?: _TileLayoutsOpenApi;/** Whether to show the description on the dashboard tile. */show_description?: boolean;widget_type: ConversationsRecentTicketsWidgetAddRequestOpenApiWidgetType;@@ -22909,6 +22909,38 @@ export namespace Schemas {properties?: unknown;}+ export interface _DashboardPatchTileLayoutBoxOpenApi {+ /**+ * Column position in the dashboard grid (0-indexed).+ * @minimum 0+ * @maximum 11+ */+ x: number;+ /**+ * Row position in the dashboard grid (0-indexed).+ * @minimum 0+ */+ y: number;+ /**+ * Width in grid columns. The desktop grid is 12 columns wide.+ * @minimum 1+ * @maximum 12+ */+ w: number;+ /**+ * Height in grid rows.+ * @minimum 1+ */+ h: number;+ }++ export interface _DashboardPatchTileLayoutsOpenApi {+ /** Layout for the standard (desktop) breakpoint. The grid is 12 columns wide. A write replaces the tile's whole layout and the dashboard reads desktop placement from this box, so send it whenever you send layouts. */+ sm: _DashboardPatchTileLayoutBoxOpenApi;+ /** Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders. */+ xs?: _DashboardPatchTileLayoutBoxOpenApi;+ }+/*** * `activity_events_list` - activity_events_list* * `conversations_recent_tickets` - conversations_recent_tickets@@ -22962,6 +22994,8 @@ export namespace Schemas {export interface DashboardPatchTileOpenApi {/** Dashboard tile ID to update. */id?: number;+ /** Grid position and size per breakpoint. Works for every tile type, including insight tiles. A write replaces the tile's whole layout, so send a complete sm box rather than the one value you want to change. Boxes are stored as sent and overlaps are not resolved, so send sm boxes that do not overlap, and include every tile you move in the same request. */+ layouts?: _DashboardPatchTileLayoutsOpenApi;/** Nested widget row updates. */widget?: DashboardPatchWidgetOpenApi;}@@ -51355,6 +51389,7 @@ export namespace Schemas {/*** * `preserve` - preserve* * `two_column` - two_column+ * * `three_column` - three_column* * `full_width` - full_width*/export type LayoutEnum = typeof LayoutEnum[keyof typeof LayoutEnum];@@ -51363,6 +51398,7 @@ export namespace Schemas {export const LayoutEnum = {Preserve: 'preserve',TwoColumn: 'two_column',+ ThreeColumn: 'three_column',FullWidth: 'full_width',} as const;@@ -69743,7 +69779,7 @@ export namespace Schemas {* * `horizontal` - horizontal* * `stable` - stable */layout_compaction?: LayoutCompactionEnum;- /** Dashboard tiles to update. Widget tiles accept nested widget.config patches. */+ /** Dashboard tiles to update, each identified by its tile id. Any tile type accepts `layouts` to set its grid position and size. Widget tiles also accept nested widget.config patches. */tiles?: DashboardPatchTileOpenApi[];/** Template key to create the dashboard from a predefined template. */use_template?: string;@@ -79760,10 +79796,11 @@ export namespace Schemas {* @minItems 1*/tile_order: number[];- /** How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height and only repacks positions in the new order. 'two_column' forces a 6-wide × 5-tall grid (two tiles per row). 'full_width' forces each tile to span the full 12-column row at height 5.+ /** How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height and only repacks positions in the new order. Use the other modes only when every tile should use the same size: 'two_column' makes every tile 6-wide × 5-tall, 'three_column' makes every tile 4-wide × 5-tall, and 'full_width' makes every tile 12-wide × 5-tall.** * `preserve` - preserve* * `two_column` - two_column+ * * `three_column` - three_column* * `full_width` - full_width */layout?: LayoutEnum;}diff --git a/services/mcp/src/generated/dashboards/api.ts b/services/mcp/src/generated/dashboards/api.tsindex 03163bebf227..561d346013b0 100644--- a/services/mcp/src/generated/dashboards/api.ts+++ b/services/mcp/src/generated/dashboards/api.ts@@ -243,6 +243,19 @@ export const DashboardsPartialUpdateQueryParams = () => zod.object({export const dashboardsPartialUpdateBodyNameMax = 400export const dashboardsPartialUpdateBodyBreakdownColorsItemColorTokenRegExp = new RegExp('^preset-[1-9][0-9]\*$')+export const dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneXMin = 0+export const dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneXMax = 11++export const dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneYMin = 0++export const dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneWMax = 12++export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneXMin = 0+export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneXMax = 11++export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneYMin = 0++export const dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneWMax = 12export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitDefault = 25export const dashboardsPartialUpdateBodyTilesItemWidgetOneConfigOneOneLimitMax = 50@@ -408,6 +421,56 @@ export const DashboardsPartialUpdateBody = () => zod.array(zod.object({id: zod.number().optional().describe('Dashboard tile ID to update.'),+ layouts: zod+ .object({+ sm: zod+ .object({+ x: zod+ .number()+ .min(dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneXMin)+ .max(dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneXMax)+ .describe('Column position in the dashboard grid (0-indexed).'),+ y: zod+ .number()+ .min(dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneYMin)+ .describe('Row position in the dashboard grid (0-indexed).'),+ w: zod+ .number()+ .min(1)+ .max(dashboardsPartialUpdateBodyTilesItemLayoutsOneSmOneWMax)+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),+ h: zod.number().min(1).describe('Height in grid rows.'),+ })+ .describe(+ "Layout for the standard (desktop) breakpoint. The grid is 12 columns wide. A write replaces the tile's whole layout and the dashboard reads desktop placement from this box, so send it whenever you send layouts."+ ),+ xs: zod+ .object({+ x: zod+ .number()+ .min(dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneXMin)+ .max(dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneXMax)+ .describe('Column position in the dashboard grid (0-indexed).'),+ y: zod+ .number()+ .min(dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneYMin)+ .describe('Row position in the dashboard grid (0-indexed).'),+ w: zod+ .number()+ .min(1)+ .max(dashboardsPartialUpdateBodyTilesItemLayoutsOneXsOneWMax)+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),+ h: zod.number().min(1).describe('Height in grid rows.'),+ })+ .optional()+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),+ })+ .optional()+ .describe(+ "Grid position and size per breakpoint. Works for every tile type, including insight tiles. A write replaces the tile's whole layout, so send a complete sm box rather than the one value you want to change. Boxes are stored as sent and overlaps are not resolved, so send sm boxes that do not overlap, and include every tile you move in the same request."+ ),widget: zod.object({id: zod@@ -1114,7 +1177,9 @@ export const DashboardsPartialUpdateBody = () => zod})).optional()- .describe('Dashboard tiles to update. Widget tiles accept nested widget.config patches.'),+ .describe(+ 'Dashboard tiles to update, each identified by its tile id. Any tile type accepts `layouts` to set its grid position and size. Widget tiles also accept nested widget.config patches.'+ ),use_template: zod.string().optional()@@ -1305,11 +1370,13 @@ export const DashboardsReorderTilesCreateBody = () => zod.object({.min(1).describe('Array of tile IDs in the desired display order (top to bottom, left to right).'),layout: zod- .enum(['preserve', 'two_column', 'full_width'])- .describe('\* `preserve` - preserve\n\* `two_column` - two_column\n\* `full_width` - full_width')+ .enum(['preserve', 'two_column', 'three_column', 'full_width'])+ .describe(+ '\* `preserve` - preserve\n\* `two_column` - two_column\n\* `three_column` - three_column\n\* `full_width` - full_width'+ ).default(dashboardsReorderTilesCreateBodyLayoutDefault).describe(- "How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height and only repacks positions in the new order. 'two_column' forces a 6-wide × 5-tall grid (two tiles per row). 'full_width' forces each tile to span the full 12-column row at height 5.\n\n\* `preserve` - preserve\n\* `two_column` - two_column\n\* `full_width` - full_width"+ "How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height and only repacks positions in the new order. Use the other modes only when every tile should use the same size: 'two_column' makes every tile 6-wide × 5-tall, 'three_column' makes every tile 4-wide × 5-tall, and 'full_width' makes every tile 12-wide × 5-tall.\n\n\* `preserve` - preserve\n\* `two_column` - two_column\n\* `three_column` - three_column\n\* `full_width` - full_width"),})@@ -1566,7 +1633,9 @@ export const DashboardsWidgetsBatchCreateBody = () => zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -1817,7 +1886,9 @@ export const DashboardsWidgetsBatchCreateBody = () => zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -1990,7 +2061,9 @@ export const DashboardsWidgetsBatchCreateBody = () => zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2168,7 +2241,9 @@ export const DashboardsWidgetsBatchCreateBody = () => zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2255,7 +2330,9 @@ export const DashboardsWidgetsBatchCreateBody = () => zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2324,7 +2401,9 @@ export const DashboardsWidgetsBatchCreateBody = () => zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2423,7 +2502,9 @@ export const DashboardsWidgetsBatchCreateBody = () => zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),@@ -2541,7 +2622,9 @@ export const DashboardsWidgetsBatchCreateBody = () => zodh: zod.number().optional().describe('Height in grid rows.'),}).optional()- .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),+ .describe(+ 'Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.'+ ),}).optional().describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),diff --git a/services/mcp/tests/tools/dashboards.integration.test.ts b/services/mcp/tests/tools/dashboards.integration.test.tsindex e752700afc63..7fd8bbc92388 100644--- a/services/mcp/tests/tools/dashboards.integration.test.ts+++ b/services/mcp/tests/tools/dashboards.integration.test.ts@@ -78,6 +78,7 @@ describe('Dashboards', { concurrent: false }, () => {describe('dashboard-update tool', () => {const createTool = getToolByName('dashboard-create')+ const getTool = getToolByName('dashboard-get')const updateTool = getToolByName('dashboard-update')it('should update dashboard name and description', async () => {@@ -99,6 +100,47 @@ describe('Dashboards', { concurrent: false }, () => {expect(updatedDashboard.id).toBe(createdDashboard.id)expect(updatedDashboard.name).toBe('Updated Dashboard Name')})++ it('should persist an insight tile layout', async () => {+ const createResult = await createTool.handler(context, {+ name: generateUniqueKey('Layout Dashboard'),+ pinned: false,+ })+ const createdDashboard = parseToolResponse(createResult)+ createdResources.dashboards.push(createdDashboard.id)++ const projectId = await context.stateManager.getProjectId()+ const insight = await context.api.request<{ id: number }>({+ method: 'POST',+ path: `/api/projects/${projectId}/insights/`,+ body: {+ name: generateUniqueKey('Layout Insight'),+ query: SAMPLE_HOGQL_QUERIES.pageviews,+ saved: true,+ dashboards: [createdDashboard.id],+ },+ })+ createdResources.insights.push(insight.id)++ const dashboardResult = await getTool.handler(context, { id: createdDashboard.id })+ const dashboard = parseToolResponse(dashboardResult)+ const tile = dashboard.tiles.find((item: { insight?: { id: number } }) => item.insight?.id === insight.id)++ if (!tile) {+ throw new Error('The created insight tile was not returned by dashboard-get')+ }++ const layouts = { sm: { x: 6, y: 0, w: 6, h: 5 } }+ await updateTool.handler(context, { id: createdDashboard.id, tiles: [{ id: tile.id, layouts }] })++ const updatedResult = await getTool.handler(context, { id: createdDashboard.id })+ const updatedDashboard = parseToolResponse(updatedResult)+ const updatedTile = updatedDashboard.tiles.find(+ (item: { insight?: { id: number } }) => item.insight?.id === insight.id+ )++ expect(updatedTile?.layouts).toEqual(layouts)+ })})describe('dashboards-get-all tool', () => {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-reorder-tiles.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-reorder-tiles.jsonindex 3484a7ef0e09..bb00cc52495c 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-reorder-tiles.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-reorder-tiles.json@@ -7,8 +7,8 @@},"layout": {"default": "preserve",- "description": "How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height and only repacks positions in the new order. 'two_column' forces a 6-wide × 5-tall grid (two tiles per row). 'full_width' forces each tile to span the full 12-column row at height 5.\n\n* `preserve` - preserve\n* `two_column` - two_column\n* `full_width` - full_width",- "enum": ["preserve", "two_column", "full_width"],+ "description": "How to size tiles when reordering. 'preserve' (default) keeps each tile's existing width and height and only repacks positions in the new order. Use the other modes only when every tile should use the same size: 'two_column' makes every tile 6-wide × 5-tall, 'three_column' makes every tile 4-wide × 5-tall, and 'full_width' makes every tile 12-wide × 5-tall.\n\n* `preserve` - preserve\n* `two_column` - two_column\n* `three_column` - three_column\n* `full_width` - full_width",+ "enum": ["preserve", "two_column", "three_column", "full_width"],"type": "string"},"tile_order": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.jsonindex 59bb7d092e57..f1251c89e9a3 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-update.json@@ -184,13 +184,78 @@"type": "array"},"tiles": {- "description": "Dashboard tiles to update. Widget tiles accept nested widget.config patches.",+ "description": "Dashboard tiles to update, each identified by its tile id. Any tile type accepts `layouts` to set its grid position and size. Widget tiles also accept nested widget.config patches.","items": {"properties": {"id": {"description": "Dashboard tile ID to update.","type": "number"},+ "layouts": {+ "description": "Grid position and size per breakpoint. Works for every tile type, including insight tiles. A write replaces the tile's whole layout, so send a complete sm box rather than the one value you want to change. Boxes are stored as sent and overlaps are not resolved, so send sm boxes that do not overlap, and include every tile you move in the same request.",+ "properties": {+ "sm": {+ "description": "Layout for the standard (desktop) breakpoint. The grid is 12 columns wide. A write replaces the tile's whole layout and the dashboard reads desktop placement from this box, so send it whenever you send layouts.",+ "properties": {+ "h": {+ "description": "Height in grid rows.",+ "minimum": 1,+ "type": "number"+ },+ "w": {+ "description": "Width in grid columns. The desktop grid is 12 columns wide.",+ "maximum": 12,+ "minimum": 1,+ "type": "number"+ },+ "x": {+ "description": "Column position in the dashboard grid (0-indexed).",+ "maximum": 11,+ "minimum": 0,+ "type": "number"+ },+ "y": {+ "description": "Row position in the dashboard grid (0-indexed).",+ "minimum": 0,+ "type": "number"+ }+ },+ "required": ["x", "y", "w", "h"],+ "type": "object"+ },+ "xs": {+ "description": "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.",+ "properties": {+ "h": {+ "description": "Height in grid rows.",+ "minimum": 1,+ "type": "number"+ },+ "w": {+ "description": "Width in grid columns. The desktop grid is 12 columns wide.",+ "maximum": 12,+ "minimum": 1,+ "type": "number"+ },+ "x": {+ "description": "Column position in the dashboard grid (0-indexed).",+ "maximum": 11,+ "minimum": 0,+ "type": "number"+ },+ "y": {+ "description": "Row position in the dashboard grid (0-indexed).",+ "minimum": 0,+ "type": "number"+ }+ },+ "required": ["x", "y", "w", "h"],+ "type": "object"+ }+ },+ "required": ["sm"],+ "type": "object"+ },"widget": {"description": "Nested widget row updates.","properties": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.jsonindex 04986500fb97..181bd89be830 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json@@ -315,7 +315,7 @@"type": "object"},"xs": {- "description": "Layout for the small (mobile) breakpoint. The grid is 1 column wide.",+ "description": "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.","properties": {"h": {"description": "Height in grid rows.",@@ -594,7 +594,7 @@"type": "object"},"xs": {- "description": "Layout for the small (mobile) breakpoint. The grid is 1 column wide.",+ "description": "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.","properties": {"h": {"description": "Height in grid rows.",@@ -861,7 +861,7 @@"type": "object"},"xs": {- "description": "Layout for the small (mobile) breakpoint. The grid is 1 column wide.",+ "description": "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.","properties": {"h": {"description": "Height in grid rows.",@@ -983,7 +983,7 @@"type": "object"},"xs": {- "description": "Layout for the small (mobile) breakpoint. The grid is 1 column wide.",+ "description": "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.","properties": {"h": {"description": "Height in grid rows.",@@ -1080,7 +1080,7 @@"type": "object"},"xs": {- "description": "Layout for the small (mobile) breakpoint. The grid is 1 column wide.",+ "description": "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.","properties": {"h": {"description": "Height in grid rows.",@@ -1218,7 +1218,7 @@"type": "object"},"xs": {- "description": "Layout for the small (mobile) breakpoint. The grid is 1 column wide.",+ "description": "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.","properties": {"h": {"description": "Height in grid rows.",@@ -1387,7 +1387,7 @@"type": "object"},"xs": {- "description": "Layout for the small (mobile) breakpoint. The grid is 1 column wide.",+ "description": "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.","properties": {"h": {"description": "Height in grid rows.",@@ -1551,7 +1551,7 @@"type": "object"},"xs": {- "description": "Layout for the small (mobile) breakpoint. The grid is 1 column wide.",+ "description": "Layout for the small (mobile) breakpoint, on a 1-column grid. The dashboard derives this layout from the sm order and heights, so a stored xs box does not change what renders.","properties": {"h": {"description": "Height in grid rows.",