Skip to content

: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.

feat(dashboards): add MCP tools for dashboard widgets (10/11) (#60497)

Matt Pua9e3047b8752f
diff --git a/.github/workflows/ci-mcp.yml b/.github/workflows/ci-mcp.yml
index d3bb1242dcdc..fccb63bd28cb 100644
--- a/.github/workflows/ci-mcp.yml
+++ b/.github/workflows/ci-mcp.yml
@@ -259,7 +259,7 @@ jobs:
DISABLE_SECURE_SSL_REDIRECT: 'True'
CLICKHOUSE_LOGS_CLUSTER_SECURE: 'False'
CELERY_METRICS_PORT: 8999
- POSTHOG_FEATURE_FLAGS_FORCE_ENABLED: 'logs-alerting'
+ POSTHOG_FEATURE_FLAGS_FORCE_ENABLED: 'logs-alerting,dashboard-widgets'
# Required for the feature_flags test_evaluation endpoint, which authenticates
# historical-flag override requests to the Rust flags service. Any non-empty
# value is fine for CI — the Rust service in the test stack accepts it.
diff --git a/posthog/helpers/dashboard_templates.py b/posthog/helpers/dashboard_templates.py
index 92b98e173405..5d2a6dd13265 100644
--- a/posthog/helpers/dashboard_templates.py
+++ b/posthog/helpers/dashboard_templates.py
@@ -621,9 +621,10 @@ def _create_tile_for_widget(
)
normalized_widget_type, validated_config = prepare_widget_tile_create(
- team_id=dashboard.team_id,
+ team=dashboard.team,
widget_type=widget_type,
config=config,
+ user=user,
user_access_control=user_access_control,
)
with team_scope(dashboard.team_id):
diff --git a/products/dashboards/backend/api/dashboard.py b/products/dashboards/backend/api/dashboard.py
index 236715b7e51b..bf3affbb6b5a 100644
--- a/products/dashboards/backend/api/dashboard.py
+++ b/products/dashboards/backend/api/dashboard.py
@@ -465,12 +465,12 @@ class DeleteTileRequestSerializer(serializers.Serializer):
class MoveTileTileSerializer(serializers.Serializer):
- id = serializers.IntegerField(help_text="Dashboard tile ID to move.")
+ id = serializers.IntegerField(required=True, help_text="Dashboard tile ID to move.")
class MoveTileRequestSerializer(serializers.Serializer):
- to_dashboard = serializers.IntegerField(help_text="Destination dashboard ID.")
- tile = MoveTileTileSerializer(help_text="Tile to move, identified by its dashboard tile ID.")
+ to_dashboard = serializers.IntegerField(required=True, help_text="Destination dashboard ID.")
+ tile = MoveTileTileSerializer(required=True, help_text="Tile to move, identified by its dashboard tile ID.")
class DashboardWidgetCoreRequestSerializer(serializers.Serializer):
@@ -1543,7 +1543,7 @@ class DashboardSerializer(DashboardMetadataSerializer):
widget_json: dict = tile_data.get("widget", {})
widget_data = DashboardSerializer._validated_patch_widget_payload(widget_json)
- if not dashboard_widgets_enabled(instance.team_id):
+ if not dashboard_widgets_enabled(team=instance.team, user=user):
raise serializers.ValidationError({"widget": "Dashboard widgets are not enabled for this project."})
user_access_control = UserAccessControl(user=user, team=instance.team)
@@ -1565,9 +1565,10 @@ class DashboardSerializer(DashboardMetadataSerializer):
else:
try:
canonical_widget_type, config = prepare_widget_tile_create(
- team_id=instance.team_id,
+ team=instance.team,
widget_type=str(widget_data["widget_type"]),
config=widget_data.get("config", {}),
+ user=user,
user_access_control=user_access_control,
)
except serializers.ValidationError as exc:
@@ -2198,7 +2199,7 @@ class DashboardsViewSet(
return layout_size
@extend_schema(request=MoveTileRequestSerializer, responses={200: DashboardSerializer})
- @action(methods=["PATCH"], detail=True, required_scopes=["dashboard:write"])
+ @action(methods=["PATCH", "POST"], detail=True, required_scopes=["dashboard:write"])
def move_tile(self, request: Request, *args: Any, **kwargs: Any) -> Response:
# TODO could things be rearranged so this is PATCH call on a resource and not a custom endpoint?
from_dashboard = self.get_object()
@@ -2218,9 +2219,10 @@ class DashboardsViewSet(
if not self.user_permissions.dashboard(to_dashboard_obj).can_edit:
raise exceptions.PermissionDenied("You don't have edit permissions for the destination dashboard.")
if tile.widget_id is not None:
- if not dashboard_widgets_enabled(self.team_id):
+ request_user = cast(User, request.user)
+ if not dashboard_widgets_enabled(team=self.team, user=request_user):
raise exceptions.ValidationError("Dashboard widgets are not enabled for this project.")
- user_access_control = UserAccessControl(user=cast(User, request.user), team=self.team)
+ user_access_control = UserAccessControl(user=request_user, team=self.team)
if tile.widget is None:
raise exceptions.ValidationError("Widget tile is missing its widget.")
DashboardSerializer._check_widget_tile_product_access(tile.widget, user_access_control)
@@ -2270,7 +2272,7 @@ class DashboardsViewSet(
)
if tile.widget_id is not None:
- if not dashboard_widgets_enabled(self.team_id):
+ if not dashboard_widgets_enabled(team=self.team, user=cast(User, request.user)):
raise exceptions.ValidationError("Dashboard widgets are not enabled for this project.")
if tile.widget is None:
raise exceptions.ValidationError("Widget tile is missing its widget.")
@@ -2565,7 +2567,7 @@ class DashboardsViewSet(
)
@action(methods=["GET"], detail=True, required_scopes=["dashboard:read"])
def run_widgets(self, request: Request, *args: Any, **kwargs: Any) -> Response:
- if not dashboard_widgets_enabled(self.team_id):
+ if not dashboard_widgets_enabled(team=self.team, user=cast(User, request.user)):
raise exceptions.PermissionDenied("Dashboard widgets are not enabled for this project.")
tile_ids_param = request.query_params.get("tile_ids")
@@ -2687,7 +2689,7 @@ class DashboardsViewSet(
@action(methods=["POST"], detail=True, url_path="widgets/batch", required_scopes=["dashboard:write"])
def widgets_batch(self, request: Request, *args: Any, **kwargs: Any) -> Response:
"""Add multiple widget tiles to a dashboard in one atomic request."""
- if not dashboard_widgets_enabled(self.team_id):
+ if not dashboard_widgets_enabled(team=self.team, user=cast(User, request.user)):
raise exceptions.ValidationError("Dashboard widgets are not enabled for this project.")
dashboard = self.get_object()
@@ -2750,9 +2752,10 @@ class DashboardsViewSet(
widget_type = payload["widget_type"]
config = payload["config"]
normalized_widget_type, validated_config = prepare_widget_tile_create(
- team_id=self.team_id,
+ team=self.team,
widget_type=widget_type,
config=config,
+ user=user,
user_access_control=user_access_control,
)
_check_dashboard_widget_count_limit(dashboard=dashboard, user=user)
diff --git a/products/dashboards/backend/feature_flags.py b/products/dashboards/backend/feature_flags.py
index 12b5b38fcfc4..a189e89c36d8 100644
--- a/products/dashboards/backend/feature_flags.py
+++ b/products/dashboards/backend/feature_flags.py
@@ -1,7 +1,34 @@
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
+
import posthoganalytics
+from posthog.permissions import _FORCE_ENABLED_FLAGS
+
+if TYPE_CHECKING:
+ from posthog.models.team import Team
+ from posthog.models.user import User
+
DASHBOARD_WIDGETS_FLAG = "dashboard-widgets"
-def dashboard_widgets_enabled(team_id: int) -> bool:
- return bool(posthoganalytics.feature_enabled(DASHBOARD_WIDGETS_FLAG, str(team_id)))
+def dashboard_widgets_enabled(*, team: Team, user: User | None = None) -> bool:
+ """Match in-app flag evaluation: user distinct_id plus project/org groups."""
+ if DASHBOARD_WIDGETS_FLAG in _FORCE_ENABLED_FLAGS:
+ return True
+
+ distinct_id = (user.distinct_id or str(user.uuid)) if user is not None else str(team.uuid)
+ organization_id = str(team.organization_id)
+ project_id = str(team.id)
+
+ return bool(
+ posthoganalytics.feature_enabled(
+ DASHBOARD_WIDGETS_FLAG,
+ distinct_id,
+ groups={"organization": organization_id, "project": project_id},
+ group_properties={"organization": {"id": organization_id}, "project": {"id": project_id}},
+ only_evaluate_locally=False,
+ send_feature_flag_events=False,
+ )
+ )
diff --git a/products/dashboards/backend/widget_create.py b/products/dashboards/backend/widget_create.py
index b67c1027b647..419e51415cf4 100644
--- a/products/dashboards/backend/widget_create.py
+++ b/products/dashboards/backend/widget_create.py
@@ -4,6 +4,8 @@ from typing import Any
from rest_framework import serializers
+from posthog.models.team import Team
+from posthog.models.user import User
from posthog.rbac.user_access_control import UserAccessControl
from products.dashboards.backend.feature_flags import dashboard_widgets_enabled
@@ -14,12 +16,13 @@ from products.dashboards.backend.widget_registry import get_widget_registry_entr
def prepare_widget_tile_create(
*,
- team_id: int,
+ team: Team,
widget_type: str,
config: dict[str, Any],
+ user: User | None = None,
user_access_control: UserAccessControl | None = None,
) -> tuple[str, dict[str, Any]]:
- if not dashboard_widgets_enabled(team_id):
+ if not dashboard_widgets_enabled(team=team, user=user):
raise serializers.ValidationError({"widget": "Dashboard widgets are not enabled for this project."})
if get_widget_registry_entry(widget_type) is None:
@@ -32,7 +35,7 @@ def prepare_widget_tile_create(
probe_widget = DashboardWidget(
widget_type=widget_type,
config=config,
- team_id=team_id,
+ team_id=team.id,
)
check_widget_tile_product_access(probe_widget, user_access_control)
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index c4ea6ae31a4d..e063453757a6 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -7649,6 +7649,13 @@ export interface MoveTileTileApi {
id: number
}
+export interface MoveTileRequestApi {
+ /** Destination dashboard ID. */
+ to_dashboard: number
+ /** Tile to move, identified by its dashboard tile ID. */
+ tile: MoveTileTileApi
+}
+
export interface PatchedMoveTileRequestApi {
/** Destination dashboard ID. */
to_dashboard?: number
@@ -8051,6 +8058,18 @@ export const DashboardsDeleteTileFormat = {
Txt: 'txt',
} as const
+export type DashboardsMoveTileCreateParams = {
+ format?: DashboardsMoveTileCreateFormat
+}
+
+export type DashboardsMoveTileCreateFormat =
+ (typeof DashboardsMoveTileCreateFormat)[keyof typeof DashboardsMoveTileCreateFormat]
+
+export const DashboardsMoveTileCreateFormat = {
+ Json: 'json',
+ Txt: 'txt',
+} as const
+
export type DashboardsMoveTilePartialUpdateParams = {
format?: DashboardsMoveTilePartialUpdateFormat
}
diff --git a/products/dashboards/frontend/generated/api.ts b/products/dashboards/frontend/generated/api.ts
index 7e7493eba235..bbe73c8d5137 100644
--- a/products/dashboards/frontend/generated/api.ts
+++ b/products/dashboards/frontend/generated/api.ts
@@ -31,6 +31,7 @@ import type {
DashboardsDeleteTileParams,
DashboardsDestroyParams,
DashboardsListParams,
+ DashboardsMoveTileCreateParams,
DashboardsMoveTilePartialUpdateParams,
DashboardsPartialUpdateParams,
DashboardsReorderTilesCreateParams,
@@ -46,6 +47,7 @@ import type {
DataColorThemeApi,
DataColorThemesListParams,
DeleteTileRequestApi,
+ MoveTileRequestApi,
PaginatedDashboardBasicListApi,
PaginatedDashboardTemplateListApi,
PaginatedDataColorThemeListApi,
@@ -609,6 +611,41 @@ export const dashboardsDeleteTile = async (
})
}
+export const getDashboardsMoveTileCreateUrl = (
+ projectId: string,
+ id: number,
+ params?: DashboardsMoveTileCreateParams
+) => {
+ const normalizedParams = new URLSearchParams()
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? 'null' : value.toString())
+ }
+ })
+
+ const stringifiedParams = normalizedParams.toString()
+
+ return stringifiedParams.length > 0
+ ? `/api/projects/${projectId}/dashboards/${id}/move_tile/?${stringifiedParams}`
+ : `/api/projects/${projectId}/dashboards/${id}/move_tile/`
+}
+
+export const dashboardsMoveTileCreate = async (
+ projectId: string,
+ id: number,
+ moveTileRequestApi: MoveTileRequestApi,
+ params?: DashboardsMoveTileCreateParams,
+ options?: RequestInit
+): Promise<DashboardApi> => {
+ return apiMutator<DashboardApi>(getDashboardsMoveTileCreateUrl(projectId, id, params), {
+ ...options,
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(moveTileRequestApi),
+ })
+}
+
export const getDashboardsMoveTilePartialUpdateUrl = (
projectId: string,
id: number,
diff --git a/products/dashboards/frontend/generated/api.zod.ts b/products/dashboards/frontend/generated/api.zod.ts
index 6857177c1085..8e5ab68df0dc 100644
--- a/products/dashboards/frontend/generated/api.zod.ts
+++ b/products/dashboards/frontend/generated/api.zod.ts
@@ -357,6 +357,15 @@ export const DashboardsDeleteTileBody = /* @__PURE__ */ zod.object({
tile_id: zod.number().describe('ID of the dashboard tile to delete. Use dashboard-get to look up tile IDs.'),
})
+export const DashboardsMoveTileCreateBody = /* @__PURE__ */ zod.object({
+ to_dashboard: zod.number().describe('Destination dashboard ID.'),
+ tile: zod
+ .object({
+ id: zod.number().describe('Dashboard tile ID to move.'),
+ })
+ .describe('Tile to move, identified by its dashboard tile ID.'),
+})
+
export const DashboardsMoveTilePartialUpdateBody = /* @__PURE__ */ zod.object({
to_dashboard: zod.number().optional().describe('Destination dashboard ID.'),
tile: zod
diff --git a/products/dashboards/mcp/tools.yaml b/products/dashboards/mcp/tools.yaml
index ad4574b2520c..b4d2b124ef33 100644
--- a/products/dashboards/mcp/tools.yaml
+++ b/products/dashboards/mcp/tools.yaml
@@ -123,12 +123,12 @@ tools:
enrich_url: '{params.id}'
title: Delete dashboard tile
description: >
- Soft-delete a single tile (text, insight, or button) from a dashboard. Behaves the same as the delete button
- in the UI — the underlying Insight, Text, or ButtonTile object is preserved (so an insight that lives on
- multiple dashboards stays on the others), and the remaining tiles are automatically compacted upward to fill
- the gap left by the deleted tile (matching the dashboard grid's layout). Pass the DashboardTile id as
- `tile_id` (use dashboard-get to look up tile IDs). To remove the whole dashboard instead, use
- dashboard-delete.
+ Soft-delete a single tile (text, insight, widget, or button) from a dashboard. Behaves the same as the
+ delete button in the UI — the underlying Insight, Text, ButtonTile, or widget row is preserved (so an
+ insight that lives on multiple dashboards stays on the others), and the remaining tiles are automatically
+ compacted upward to fill the gap left by the deleted tile (matching the dashboard grid's layout). Pass the
+ DashboardTile id as `tile_id` (use dashboard-get to look up tile IDs). To remove the whole dashboard
+ instead, use dashboard-delete.
param_overrides:
id:
cast: string-int
@@ -144,12 +144,14 @@ tools:
enrich_url: '{id}'
title: Get dashboard
description: >
- Get a specific dashboard by ID. Returns the full dashboard including all tiles with their insights and
- layout information. Insight results, filters, and query metadata are omitted to save context — use
- dashboard-insights-run to fetch the actual data for every insight on the dashboard in one call, or
- insight-query for a single insight. Supports variables_override and filters_override query params; on this
- endpoint they affect only the merged `filters` and `variables` fields in the response (preview). To execute
- insights with the same overrides, pass the same query params to dashboard-insights-run.
+ Get a specific dashboard by ID. Returns the full dashboard including all tiles with their insights, widget
+ configurations, and layout information. Widget tiles include a `widget` object with `widget_type` and
+ `config` but no live data — use dashboard-widgets-run with tile IDs from this response. Insight results,
+ filters, and query metadata are omitted to save context — use dashboard-insights-run to fetch the actual
+ data for every insight on the dashboard in one call, or insight-query for a single insight. Supports
+ variables_override and filters_override query params; on this endpoint they affect only the merged `filters`
+ and `variables` fields in the response (preview). To execute insights with the same overrides, pass the same
+ query params to dashboard-insights-run.
param_overrides:
id:
cast: string-int
@@ -248,6 +250,24 @@ tools:
dashboard-templates-update:
operation: dashboard_templates_update
enabled: false
+ dashboard-tile-copy:
+ operation: dashboards_copy_tile_create
+ enabled: true
+ scopes:
+ - dashboard:write
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: false
+ enrich_url: '{id}'
+ title: Copy dashboard tile
+ description: >
+ Copy an insight, text card, or widget tile from one dashboard to another. The path dashboard ID is the
+ destination. Provide fromDashboardId (source dashboard) and tileId (tile to copy). Widget tiles require the
+ dashboard-widgets feature flag and are deep-cloned with a new widget row.
+ param_overrides:
+ id:
+ cast: string-int
dashboard-update:
operation: dashboards_partial_update
enabled: true
@@ -261,8 +281,10 @@ tools:
title: Update dashboard
description: >
Update an existing dashboard by ID. Can update name, description, pinned status, tags, filters, and
- restriction level. The returned tiles omit insight results to save context — use dashboard-insights-run to
- fetch the actual data for each insight.
+ restriction level. To update widget tiles, pass `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.
+ There is no separate PATCH .../widgets/:tile_id/ endpoint. 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_level
@@ -333,6 +355,60 @@ tools:
param_overrides:
id:
cast: string-int
+ dashboard-widget-catalog-list:
+ operation: dashboards_widget_catalog_retrieve
+ enabled: true
+ scopes:
+ - dashboard:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ title: List dashboard widget catalog
+ description: >
+ List registered dashboard widget types with labels, descriptions, and config_schema_hints. Use before
+ dashboard-widgets-batch-add to pick a widget_type and shape config.
+ dashboard-widgets-batch-add:
+ operation: dashboards_widgets_batch_create
+ enabled: true
+ scopes:
+ - dashboard:write
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: false
+ enrich_url: '{params.id}'
+ title: Add dashboard widgets
+ description: >
+ Add widget tiles to a dashboard atomically via POST .../widgets/batch/ (1–10 tiles). Call
+ dashboard-widget-catalog-list first for valid widget_type values and config_schema_hints. Pass `widgets` as
+ an array of payloads (widget_type, config, optional name, description, layouts). For a single tile, pass a
+ one-element `widgets` array. Tiles stack at the bottom when layouts are omitted. Returns all created tiles;
+ use dashboard-widgets-run to fetch live data.
+ param_overrides:
+ id:
+ cast: string-int
+ feature_flag: dashboard-widgets
+ dashboard-widgets-run:
+ operation: dashboards_run_widgets_retrieve
+ enabled: true
+ scopes:
+ - dashboard:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ enrich_url: '{params.id}'
+ title: Run dashboard widgets
+ description: >
+ Run live queries for dashboard widget tiles and return results. Requires the dashboard-widgets feature flag.
+ Call dashboard-get first to find widget tile IDs (tiles with a widget field). Pass tile_ids as a
+ comma-separated list. Returns per-tile errors when the caller lacks product access for a widget type (see
+ required_product_access on dashboard-widget-catalog-list).
+ param_overrides:
+ id:
+ cast: string-int
+ feature_flag: dashboard-widgets
dashboards-analyze-refresh-result-create:
operation: dashboards_analyze_refresh_result_create
enabled: false
@@ -382,12 +458,27 @@ tools:
cast: string-int
offset:
cast: string-int
+ dashboards-move-tile-create:
+ operation: dashboards_move_tile_create
+ enabled: false
dashboards-move-tile-partial-update:
operation: dashboards_move_tile_partial_update
- enabled: false
- dashboards-run-widgets-retrieve:
- operation: dashboards_run_widgets_retrieve
- enabled: false
+ enabled: true
+ scopes:
+ - dashboard:write
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: true
+ enrich_url: '{id}'
+ title: Move dashboard tile
+ description: >
+ Move a tile from the source dashboard (path ID) to another dashboard. Provide to_dashboard (destination
+ dashboard ID) and tile.id (tile ID from dashboard-get). Works for insight, text, and widget tiles; widget
+ tiles require the dashboard-widgets feature flag on the project.
+ param_overrides:
+ id:
+ cast: string-int
dashboards-sharing-list:
operation: dashboards_sharing_list
enabled: false
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 709f0d5a90dc..cbaf6976cc4f 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -1009,7 +1009,7 @@
}
},
"dashboard-delete-tile": {
- "description": "Soft-delete a single tile (text, insight, or button) from a dashboard. Behaves the same as the delete button in the UI — the underlying Insight, Text, or ButtonTile object is preserved (so an insight that lives on multiple dashboards stays on the others), and the remaining tiles are automatically compacted upward to fill the gap left by the deleted tile (matching the dashboard grid's layout). Pass the DashboardTile id as `tile_id` (use dashboard-get to look up tile IDs). To remove the whole dashboard instead, use dashboard-delete.",
+ "description": "Soft-delete a single tile (text, insight, widget, or button) from a dashboard. Behaves the same as the delete button in the UI — the underlying Insight, Text, ButtonTile, or widget row is preserved (so an insight that lives on multiple dashboards stays on the others), and the remaining tiles are automatically compacted upward to fill the gap left by the deleted tile (matching the dashboard grid's layout). Pass the DashboardTile id as `tile_id` (use dashboard-get to look up tile IDs). To remove the whole dashboard instead, use dashboard-delete.",
"category": "Dashboards",
"feature": "dashboards",
"summary": "Delete dashboard tile",
@@ -1023,7 +1023,7 @@
}
},
"dashboard-get": {
- "description": "Get a specific dashboard by ID. Returns the full dashboard including all tiles with their insights and layout information. Insight results, filters, and query metadata are omitted to save context — use dashboard-insights-run to fetch the actual data for every insight on the dashboard in one call, or insight-query for a single insight. Supports variables_override and filters_override query params; on this endpoint they affect only the merged `filters` and `variables` fields in the response (preview). To execute insights with the same overrides, pass the same query params to dashboard-insights-run.",
+ "description": "Get a specific dashboard by ID. Returns the full dashboard including all tiles with their insights, widget configurations, and layout information. Widget tiles include a `widget` object with `widget_type` and `config` but no live data — use dashboard-widgets-run with tile IDs from this response. Insight results, filters, and query metadata are omitted to save context — use dashboard-insights-run to fetch the actual data for every insight on the dashboard in one call, or insight-query for a single insight. Supports variables_override and filters_override query params; on this endpoint they affect only the merged `filters` and `variables` fields in the response (preview). To execute insights with the same overrides, pass the same query params to dashboard-insights-run.",
"category": "Dashboards",
"feature": "dashboards",
"summary": "Get dashboard",
@@ -1064,8 +1064,22 @@
"readOnlyHint": false
}
},
+ "dashboard-tile-copy": {
+ "description": "Copy an insight, text card, or widget tile from one dashboard to another. The path dashboard ID is the destination. Provide fromDashboardId (source dashboard) and tileId (tile to copy). Widget tiles require the dashboard-widgets feature flag and are deep-cloned with a new widget row.",
+ "category": "Dashboards",
+ "feature": "dashboards",
+ "summary": "Copy dashboard tile",
+ "title": "Copy dashboard tile",
+ "required_scopes": ["dashboard:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
"dashboard-update": {
- "description": "Update an existing dashboard by ID. Can update name, description, pinned status, tags, filters, and restriction level. 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 update widget tiles, pass `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. There is no separate PATCH .../widgets/:tile_id/ endpoint. 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",
@@ -1092,6 +1106,50 @@
"readOnlyHint": false
}
},
+ "dashboard-widget-catalog-list": {
+ "description": "List registered dashboard widget types with labels, descriptions, and config_schema_hints. Use before dashboard-widgets-batch-add to pick a widget_type and shape config.",
+ "category": "Dashboards",
+ "feature": "dashboards",
+ "summary": "List dashboard widget catalog",
+ "title": "List dashboard widget catalog",
+ "required_scopes": ["dashboard:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
+ "dashboard-widgets-batch-add": {
+ "description": "Add widget tiles to a dashboard atomically via POST .../widgets/batch/ (1–10 tiles). Call dashboard-widget-catalog-list first for valid widget_type values and config_schema_hints. Pass `widgets` as an array of payloads (widget_type, config, optional name, description, layouts). For a single tile, pass a one-element `widgets` array. Tiles stack at the bottom when layouts are omitted. Returns all created tiles; use dashboard-widgets-run to fetch live data.",
+ "category": "Dashboards",
+ "feature": "dashboards",
+ "summary": "Add dashboard widgets",
+ "title": "Add dashboard widgets",
+ "required_scopes": ["dashboard:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "dashboard-widgets"
+ },
+ "dashboard-widgets-run": {
+ "description": "Run live queries for dashboard widget tiles and return results. Requires the dashboard-widgets feature flag. Call dashboard-get first to find widget tile IDs (tiles with a widget field). Pass tile_ids as a comma-separated list. Returns per-tile errors when the caller lacks product access for a widget type (see required_product_access on dashboard-widget-catalog-list).",
+ "category": "Dashboards",
+ "feature": "dashboards",
+ "summary": "Run dashboard widgets",
+ "title": "Run dashboard widgets",
+ "required_scopes": ["dashboard:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "dashboard-widgets"
+ },
"dashboards-get-all": {
"description": "List dashboards in the project. The optional `search` parameter runs a fuzzy match against name and description using Postgres trigram word similarity (handles typos, transpositions, and prefix-as-you-type) and returns results ranked by relevance — use it to find a specific dashboard by name rather than paging through every dashboard. `search` is capped at 200 characters; longer queries return a 400 error. Optional filters by tag and pinned status are also supported. Returns name, description, pinned status, tags, and creation metadata. Tiles and insights are not included — use dashboard-get to fetch a dashboard's tiles, then dashboard-insights-run to fetch the actual data for each insight.",
"category": "Dashboards",
@@ -1106,6 +1164,20 @@
"readOnlyHint": true
}
},
+ "dashboards-move-tile-partial-update": {
+ "description": "Move a tile from the source dashboard (path ID) to another dashboard. Provide to_dashboard (destination dashboard ID) and tile.id (tile ID from dashboard-get). Works for insight, text, and widget tiles; widget tiles require the dashboard-widgets feature flag on the project.",
+ "category": "Dashboards",
+ "feature": "dashboards",
+ "summary": "Move dashboard tile",
+ "title": "Move dashboard tile",
+ "required_scopes": ["dashboard:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
"data-warehouse-data-health-issues-retrieve": {
"description": "Return all failed or degraded items across the data pipeline: materialized saved queries that failed, external data schemas in Failed or BillingLimitReached state, sources in Error state, failed batch exports, and disabled/degraded transformations. Each entry includes id, name, type (materialized_view, external_data_sync, source, destination, transformation), status, error message, failed_at, and url. Use this for a one-shot audit of what's broken in a project's data warehouse.",
"category": "Data warehouse",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 8c4904340728..62efbea94708 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -1025,7 +1025,7 @@
}
},
"dashboard-delete-tile": {
- "description": "Soft-delete a single tile (text, insight, or button) from a dashboard. Behaves the same as the delete button in the UI — the underlying Insight, Text, or ButtonTile object is preserved (so an insight that lives on multiple dashboards stays on the others), and the remaining tiles are automatically compacted upward to fill the gap left by the deleted tile (matching the dashboard grid's layout). Pass the DashboardTile id as `tile_id` (use dashboard-get to look up tile IDs). To remove the whole dashboard instead, use dashboard-delete.",
+ "description": "Soft-delete a single tile (text, insight, widget, or button) from a dashboard. Behaves the same as the delete button in the UI — the underlying Insight, Text, ButtonTile, or widget row is preserved (so an insight that lives on multiple dashboards stays on the others), and the remaining tiles are automatically compacted upward to fill the gap left by the deleted tile (matching the dashboard grid's layout). Pass the DashboardTile id as `tile_id` (use dashboard-get to look up tile IDs). To remove the whole dashboard instead, use dashboard-delete.",
"category": "Dashboards",
"feature": "dashboards",
"summary": "Delete dashboard tile",
@@ -1039,7 +1039,7 @@
}
},
"dashboard-get": {
- "description": "Get a specific dashboard by ID. Returns the full dashboard including all tiles with their insights and layout information. Insight results, filters, and query metadata are omitted to save context — use dashboard-insights-run to fetch the actual data for every insight on the dashboard in one call, or insight-query for a single insight. Supports variables_override and filters_override query params; on this endpoint they affect only the merged `filters` and `variables` fields in the response (preview). To execute insights with the same overrides, pass the same query params to dashboard-insights-run.",
+ "description": "Get a specific dashboard by ID. Returns the full dashboard including all tiles with their insights, widget configurations, and layout information. Widget tiles include a `widget` object with `widget_type` and `config` but no live data — use dashboard-widgets-run with tile IDs from this response. Insight results, filters, and query metadata are omitted to save context — use dashboard-insights-run to fetch the actual data for every insight on the dashboard in one call, or insight-query for a single insight. Supports variables_override and filters_override query params; on this endpoint they affect only the merged `filters` and `variables` fields in the response (preview). To execute insights with the same overrides, pass the same query params to dashboard-insights-run.",
"category": "Dashboards",
"feature": "dashboards",
"summary": "Get dashboard",
@@ -1080,8 +1080,22 @@
"readOnlyHint": false
}
},
+ "dashboard-tile-copy": {
+ "description": "Copy an insight, text card, or widget tile from one dashboard to another. The path dashboard ID is the destination. Provide fromDashboardId (source dashboard) and tileId (tile to copy). Widget tiles require the dashboard-widgets feature flag and are deep-cloned with a new widget row.",
+ "category": "Dashboards",
+ "feature": "dashboards",
+ "summary": "Copy dashboard tile",
+ "title": "Copy dashboard tile",
+ "required_scopes": ["dashboard:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
"dashboard-update": {
- "description": "Update an existing dashboard by ID. Can update name, description, pinned status, tags, filters, and restriction level. 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 update widget tiles, pass `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. There is no separate PATCH .../widgets/:tile_id/ endpoint. 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",
@@ -1108,6 +1122,50 @@
"readOnlyHint": false
}
},
+ "dashboard-widget-catalog-list": {
+ "description": "List registered dashboard widget types with labels, descriptions, and config_schema_hints. Use before dashboard-widgets-batch-add to pick a widget_type and shape config.",
+ "category": "Dashboards",
+ "feature": "dashboards",
+ "summary": "List dashboard widget catalog",
+ "title": "List dashboard widget catalog",
+ "required_scopes": ["dashboard:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ }
+ },
+ "dashboard-widgets-batch-add": {
+ "description": "Add widget tiles to a dashboard atomically via POST .../widgets/batch/ (1–10 tiles). Call dashboard-widget-catalog-list first for valid widget_type values and config_schema_hints. Pass `widgets` as an array of payloads (widget_type, config, optional name, description, layouts). For a single tile, pass a one-element `widgets` array. Tiles stack at the bottom when layouts are omitted. Returns all created tiles; use dashboard-widgets-run to fetch live data.",
+ "category": "Dashboards",
+ "feature": "dashboards",
+ "summary": "Add dashboard widgets",
+ "title": "Add dashboard widgets",
+ "required_scopes": ["dashboard:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "dashboard-widgets"
+ },
+ "dashboard-widgets-run": {
+ "description": "Run live queries for dashboard widget tiles and return results. Requires the dashboard-widgets feature flag. Call dashboard-get first to find widget tile IDs (tiles with a widget field). Pass tile_ids as a comma-separated list. Returns per-tile errors when the caller lacks product access for a widget type (see required_product_access on dashboard-widget-catalog-list).",
+ "category": "Dashboards",
+ "feature": "dashboards",
+ "summary": "Run dashboard widgets",
+ "title": "Run dashboard widgets",
+ "required_scopes": ["dashboard:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "dashboard-widgets"
+ },
"dashboards-get-all": {
"description": "List dashboards in the project. The optional `search` parameter runs a fuzzy match against name and description using Postgres trigram word similarity (handles typos, transpositions, and prefix-as-you-type) and returns results ranked by relevance — use it to find a specific dashboard by name rather than paging through every dashboard. `search` is capped at 200 characters; longer queries return a 400 error. Optional filters by tag and pinned status are also supported. Returns name, description, pinned status, tags, and creation metadata. Tiles and insights are not included — use dashboard-get to fetch a dashboard's tiles, then dashboard-insights-run to fetch the actual data for each insight.",
"category": "Dashboards",
@@ -1122,6 +1180,20 @@
"readOnlyHint": true
}
},
+ "dashboards-move-tile-partial-update": {
+ "description": "Move a tile from the source dashboard (path ID) to another dashboard. Provide to_dashboard (destination dashboard ID) and tile.id (tile ID from dashboard-get). Works for insight, text, and widget tiles; widget tiles require the dashboard-widgets feature flag on the project.",
+ "category": "Dashboards",
+ "feature": "dashboards",
+ "summary": "Move dashboard tile",
+ "title": "Move dashboard tile",
+ "required_scopes": ["dashboard:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ }
+ },
"data-warehouse-data-health-issues-retrieve": {
"description": "Return all failed or degraded items across the data pipeline: materialized saved queries that failed, external data schemas in Failed or BillingLimitReached state, sources in Error state, failed batch exports, and disabled/degraded transformations. Each entry includes id, name, type (materialized_view, external_data_sync, source, destination, transformation), status, error message, failed_at, and url. Use this for a one-shot audit of what's broken in a project's data warehouse.",
"category": "Data warehouse",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 0e8b4f9ffa7f..4b43dc493b3f 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -21993,6 +21993,13 @@ export namespace Schemas {
id: number;
}
+ export interface MoveTileRequest {
+ /** Destination dashboard ID. */
+ to_dashboard: number;
+ /** Tile to move, identified by its dashboard tile ID. */
+ tile: MoveTileTile;
+ }
+
export interface MyFlagsResponse {
feature_flag: MinimalFeatureFlag;
value: unknown;
@@ -40332,6 +40339,18 @@ export namespace Schemas {
Txt: 'txt',
} as const;
+ export type EnvironmentsDashboardsMoveTileCreateParams = {
+ format?: EnvironmentsDashboardsMoveTileCreateFormat;
+ };
+
+ export type EnvironmentsDashboardsMoveTileCreateFormat = typeof EnvironmentsDashboardsMoveTileCreateFormat[keyof typeof EnvironmentsDashboardsMoveTileCreateFormat];
+
+
+ export const EnvironmentsDashboardsMoveTileCreateFormat = {
+ Json: 'json',
+ Txt: 'txt',
+ } as const;
+
export type EnvironmentsDashboardsMoveTilePartialUpdateParams = {
format?: EnvironmentsDashboardsMoveTilePartialUpdateFormat;
};
@@ -45365,6 +45384,18 @@ export namespace Schemas {
Txt: 'txt',
} as const;
+ export type DashboardsMoveTileCreateParams = {
+ format?: DashboardsMoveTileCreateFormat;
+ };
+
+ export type DashboardsMoveTileCreateFormat = typeof DashboardsMoveTileCreateFormat[keyof typeof DashboardsMoveTileCreateFormat];
+
+
+ export const DashboardsMoveTileCreateFormat = {
+ Json: 'json',
+ Txt: 'txt',
+ } as const;
+
export type DashboardsMoveTilePartialUpdateParams = {
format?: DashboardsMoveTilePartialUpdateFormat;
};
diff --git a/services/mcp/src/generated/dashboards/api.ts b/services/mcp/src/generated/dashboards/api.ts
index 3c77e0525f8f..886d93dfe17a 100644
--- a/services/mcp/src/generated/dashboards/api.ts
+++ b/services/mcp/src/generated/dashboards/api.ts
@@ -3,7 +3,7 @@
* MCP service uses these Zod schemas for generated tool handlers.
* To regenerate: hogli build:openapi
*
- * PostHog API - MCP 10 enabled ops
+ * PostHog API - MCP 15 enabled ops
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
@@ -160,6 +160,27 @@ export const DashboardsDestroyQueryParams = /* @__PURE__ */ zod.object({
format: zod.enum(['json', 'txt']).optional(),
})
+/**
+ * Copy an existing dashboard tile to another dashboard (insight, text card, or widget tile).
+ */
+export const DashboardsCopyTileCreateParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this dashboard.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const DashboardsCopyTileCreateQueryParams = /* @__PURE__ */ zod.object({
+ format: zod.enum(['json', 'txt']).optional(),
+})
+
+export const DashboardsCopyTileCreateBody = /* @__PURE__ */ zod.object({
+ fromDashboardId: zod.number().describe('Dashboard id the tile currently belongs to.'),
+ tileId: zod.number().describe('Dashboard tile id to copy.'),
+})
+
/**
* Add a markdown text tile to a dashboard.
@@ -247,6 +268,29 @@ export const DashboardsDeleteTileBody = /* @__PURE__ */ zod.object({
tile_id: zod.number().describe('ID of the dashboard tile to delete. Use dashboard-get to look up tile IDs.'),
})
+export const DashboardsMoveTilePartialUpdateParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this dashboard.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const DashboardsMoveTilePartialUpdateQueryParams = /* @__PURE__ */ zod.object({
+ format: zod.enum(['json', 'txt']).optional(),
+})
+
+export const DashboardsMoveTilePartialUpdateBody = /* @__PURE__ */ zod.object({
+ to_dashboard: zod.number().optional().describe('Destination dashboard ID.'),
+ tile: zod
+ .object({
+ id: zod.number().describe('Dashboard tile ID to move.'),
+ })
+ .optional()
+ .describe('Tile to move, identified by its dashboard tile ID.'),
+})
+
export const DashboardsReorderTilesCreateParams = /* @__PURE__ */ zod.object({
id: zod.number().describe('A unique integer value identifying this dashboard.'),
project_id: zod
@@ -316,6 +360,20 @@ export const DashboardsRunInsightsRetrieveQueryParams = /* @__PURE__ */ zod.obje
),
})
+export const DashboardsRunWidgetsRetrieveParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this dashboard.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const DashboardsRunWidgetsRetrieveQueryParams = /* @__PURE__ */ zod.object({
+ format: zod.enum(['json', 'txt']).optional(),
+ tile_ids: zod.string().describe('Comma-separated dashboard tile IDs to run widgets for.'),
+})
+
/**
* Update the markdown body, layout, or color of an existing text tile on a dashboard.
*/
@@ -373,3 +431,232 @@ export const DashboardsUpdateTextTileCreateBody = /* @__PURE__ */ zod.object({
.nullish()
.describe('New accent color name, empty string or null to clear. Omit to leave unchanged.'),
})
+
+/**
+ * Add multiple widget tiles to a dashboard in one atomic request.
+ */
+export const DashboardsWidgetsBatchCreateParams = /* @__PURE__ */ zod.object({
+ id: zod.number().describe('A unique integer value identifying this dashboard.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const DashboardsWidgetsBatchCreateQueryParams = /* @__PURE__ */ zod.object({
+ format: zod.enum(['json', 'txt']).optional(),
+})
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemWidgetTypeMax = 64
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneOneLimitDefault = 10
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneOneLimitMax = 25
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneOneOrderByDefault = `occurrences`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneOneOrderDirectionDefault = `DESC`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneOneStatusDefault = `active`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneTwoLimitDefault = 10
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneTwoLimitMax = 25
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneTwoOrderByDefault = `start_time`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneTwoOrderDirectionDefault = `DESC`
+export const dashboardsWidgetsBatchCreateBodyWidgetsItemNameMax = 400
+
+export const dashboardsWidgetsBatchCreateBodyWidgetsMax = 10
+
+export const DashboardsWidgetsBatchCreateBody = /* @__PURE__ */ zod.object({
+ widgets: zod
+ .array(
+ zod.object({
+ widget_type: zod
+ .string()
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemWidgetTypeMax)
+ .describe(
+ 'Widget type identifier. Supported values: error_tracking_list, session_replay_list. Use dashboard-widget-catalog-list for config_schema_hints per type.'
+ ),
+ config: zod
+ .union([
+ zod.object({
+ limit: zod
+ .number()
+ .min(1)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneOneLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneOneLimitDefault)
+ .describe('Maximum number of issues to return.'),
+ orderBy: zod
+ .enum(['last_seen', 'first_seen', 'occurrences', 'users', 'sessions'])
+ .describe(
+ '* `last_seen` - last_seen\n* `first_seen` - first_seen\n* `occurrences` - occurrences\n* `users` - users\n* `sessions` - sessions'
+ )
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneOneOrderByDefault)
+ .describe(
+ 'Issue ranking column.\n\n* `first_seen` - first_seen\n* `last_seen` - last_seen\n* `occurrences` - occurrences\n* `sessions` - sessions\n* `users` - users'
+ ),
+ orderDirection: zod
+ .enum(['ASC', 'DESC'])
+ .describe('* `ASC` - ASC\n* `DESC` - DESC')
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneOneOrderDirectionDefault)
+ .describe('Sort direction for orderBy.\n\n* `ASC` - ASC\n* `DESC` - DESC'),
+ status: zod
+ .enum(['archived', 'active', 'resolved', 'pending_release', 'suppressed', 'all'])
+ .describe(
+ '* `archived` - archived\n* `active` - active\n* `resolved` - resolved\n* `pending_release` - pending_release\n* `suppressed` - suppressed\n* `all` - all'
+ )
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneOneStatusDefault)
+ .describe(
+ 'Issue status filter.\n\n* `archived` - archived\n* `active` - active\n* `resolved` - resolved\n* `pending_release` - pending_release\n* `suppressed` - suppressed\n* `all` - all'
+ ),
+ dateRange: zod
+ .union([
+ zod.object({
+ date_from: zod
+ .union([
+ zod
+ .enum(['-14d', '-1h', '-24h', '-30d', '-3h', '-7d', '-90d'])
+ .describe(
+ '* `-14d` - -14d\n* `-1h` - -1h\n* `-24h` - -24h\n* `-30d` - -30d\n* `-3h` - -3h\n* `-7d` - -7d\n* `-90d` - -90d'
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Relative lookback window (for example '-7d'). Omit to use the project default range.\n\n* `-14d` - -14d\n* `-1h` - -1h\n* `-24h` - -24h\n* `-30d` - -30d\n* `-3h` - -3h\n* `-7d` - -7d\n* `-90d` - -90d"
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Optional relative date range override.'),
+ filterTestAccounts: zod
+ .boolean()
+ .optional()
+ .describe('When omitted, follows the project default for filtering test accounts.'),
+ }),
+ zod.object({
+ limit: zod
+ .number()
+ .min(1)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneTwoLimitMax)
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneTwoLimitDefault)
+ .describe('Maximum number of recordings to return.'),
+ orderBy: zod
+ .enum([
+ 'activity_score',
+ 'click_count',
+ 'console_error_count',
+ 'duration',
+ 'recording_duration',
+ 'start_time',
+ ])
+ .describe(
+ '* `activity_score` - activity_score\n* `click_count` - click_count\n* `console_error_count` - console_error_count\n* `duration` - duration\n* `recording_duration` - recording_duration\n* `start_time` - start_time'
+ )
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneTwoOrderByDefault)
+ .describe(
+ 'Recording ranking column.\n\n* `activity_score` - activity_score\n* `click_count` - click_count\n* `console_error_count` - console_error_count\n* `duration` - duration\n* `recording_duration` - recording_duration\n* `start_time` - start_time'
+ ),
+ orderDirection: zod
+ .enum(['ASC', 'DESC'])
+ .describe('* `ASC` - ASC\n* `DESC` - DESC')
+ .default(dashboardsWidgetsBatchCreateBodyWidgetsItemConfigOneTwoOrderDirectionDefault)
+ .describe('Sort direction for orderBy.\n\n* `ASC` - ASC\n* `DESC` - DESC'),
+ dateRange: zod
+ .union([
+ zod.object({
+ date_from: zod
+ .union([
+ zod
+ .enum(['-14d', '-1h', '-24h', '-30d', '-3h', '-7d', '-90d'])
+ .describe(
+ '* `-14d` - -14d\n* `-1h` - -1h\n* `-24h` - -24h\n* `-30d` - -30d\n* `-3h` - -3h\n* `-7d` - -7d\n* `-90d` - -90d'
+ ),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Relative lookback window (for example '-7d'). Omit to use the project default range.\n\n* `-14d` - -14d\n* `-1h` - -1h\n* `-24h` - -24h\n* `-30d` - -30d\n* `-3h` - -3h\n* `-7d` - -7d\n* `-90d` - -90d"
+ ),
+ }),
+ zod.null(),
+ ])
+ .optional()
+ .describe('Optional relative date range override.'),
+ filterTestAccounts: zod
+ .boolean()
+ .optional()
+ .describe('When omitted, follows the project default for filtering test accounts.'),
+ }),
+ ])
+ .describe(
+ 'Widget-specific configuration. Shape depends on widget_type; see dashboard-widget-catalog-list for config_schema_hints. Supported types: error_tracking_list, session_replay_list.'
+ ),
+ name: zod
+ .string()
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsItemNameMax)
+ .nullish()
+ .describe('Optional custom display name for the widget tile.'),
+ description: zod
+ .string()
+ .optional()
+ .describe('Optional markdown description shown when show_description is enabled.'),
+ layouts: zod
+ .object({
+ sm: zod
+ .object({
+ x: zod
+ .number()
+ .optional()
+ .describe('Column position in the dashboard grid (0-indexed).'),
+ y: zod.number().optional().describe('Row position in the dashboard grid (0-indexed).'),
+ w: zod
+ .number()
+ .optional()
+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),
+ h: zod.number().optional().describe('Height in grid rows.'),
+ })
+ .optional()
+ .describe('Layout for the standard (desktop) breakpoint. The grid is 12 columns wide.'),
+ xs: zod
+ .object({
+ x: zod
+ .number()
+ .optional()
+ .describe('Column position in the dashboard grid (0-indexed).'),
+ y: zod.number().optional().describe('Row position in the dashboard grid (0-indexed).'),
+ w: zod
+ .number()
+ .optional()
+ .describe('Width in grid columns. The desktop grid is 12 columns wide.'),
+ h: zod.number().optional().describe('Height in grid rows.'),
+ })
+ .optional()
+ .describe('Layout for the small (mobile) breakpoint. The grid is 1 column wide.'),
+ })
+ .optional()
+ .describe('Optional react-grid-layout positions keyed by breakpoint (sm, xs).'),
+ show_description: zod
+ .boolean()
+ .optional()
+ .describe('Whether to show the description on the dashboard tile.'),
+ })
+ )
+ .min(1)
+ .max(dashboardsWidgetsBatchCreateBodyWidgetsMax)
+ .describe('Widget tiles to add atomically (1–10). Use a single-element list to add one widget.'),
+})
+
+/**
+ * List registered dashboard widget types and config hints for agents.
+ */
+export const DashboardsWidgetCatalogRetrieveParams = /* @__PURE__ */ zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const DashboardsWidgetCatalogRetrieveQueryParams = /* @__PURE__ */ zod.object({
+ format: zod.enum(['json', 'txt']).optional(),
+})
diff --git a/services/mcp/src/tools/generated/dashboards.ts b/services/mcp/src/tools/generated/dashboards.ts
index ce936668d1b8..ed28aef26197 100644
--- a/services/mcp/src/tools/generated/dashboards.ts
+++ b/services/mcp/src/tools/generated/dashboards.ts
@@ -3,6 +3,8 @@ import { z } from 'zod'
import type { Schemas } from '@/api/generated'
import {
+ DashboardsCopyTileCreateBody,
+ DashboardsCopyTileCreateParams,
DashboardsCreateBody,
DashboardsCreateTextTileCreateBody,
DashboardsCreateTextTileCreateParams,
@@ -10,6 +12,8 @@ import {
DashboardsDeleteTileParams,
DashboardsDestroyParams,
DashboardsListQueryParams,
+ DashboardsMoveTilePartialUpdateBody,
+ DashboardsMoveTilePartialUpdateParams,
DashboardsPartialUpdateBody,
DashboardsPartialUpdateParams,
DashboardsReorderTilesCreateBody,
@@ -18,8 +22,12 @@ import {
DashboardsRetrieveQueryParams,
DashboardsRunInsightsRetrieveParams,
DashboardsRunInsightsRetrieveQueryParams,
+ DashboardsRunWidgetsRetrieveParams,
+ DashboardsRunWidgetsRetrieveQueryParams,
DashboardsUpdateTextTileCreateBody,
DashboardsUpdateTextTileCreateParams,
+ DashboardsWidgetsBatchCreateBody,
+ DashboardsWidgetsBatchCreateParams,
} from '@/generated/dashboards/api'
import { castStringToInt } from '@/tools/cast-helpers'
import { withPostHogUrl, omitResponseFields, type WithPostHogUrl } from '@/tools/tool-utils'
@@ -322,6 +330,31 @@ const dashboardReorderTiles = (): ToolBase<typeof DashboardReorderTilesSchema, W
},
})
+const DashboardTileCopySchema = DashboardsCopyTileCreateParams.omit({ project_id: true })
+ .extend(DashboardsCopyTileCreateBody.shape)
+ .extend({ id: z.preprocess(castStringToInt, DashboardsCopyTileCreateParams.shape['id']) })
+
+const dashboardTileCopy = (): ToolBase<typeof DashboardTileCopySchema, WithPostHogUrl<Schemas.Dashboard>> => ({
+ name: 'dashboard-tile-copy',
+ schema: DashboardTileCopySchema,
+ handler: async (context: Context, params: z.infer<typeof DashboardTileCopySchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.fromDashboardId !== undefined) {
+ body['fromDashboardId'] = params.fromDashboardId
+ }
+ if (params.tileId !== undefined) {
+ body['tileId'] = params.tileId
+ }
+ const result = await context.api.request<Schemas.Dashboard>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/dashboards/${encodeURIComponent(String(params.id))}/copy_tile/`,
+ body,
+ })
+ return await withPostHogUrl(context, result, `/dashboard/${result.id}`)
+ },
+})
+
const DashboardUpdateSchema = DashboardsPartialUpdateParams.omit({ project_id: true })
.extend(DashboardsPartialUpdateBody.shape)
.extend({ id: z.preprocess(castStringToInt, DashboardsPartialUpdateParams.shape['id']) })
@@ -445,6 +478,73 @@ const dashboardUpdateTextTile = (): ToolBase<
},
})
+const DashboardWidgetCatalogListSchema = z.object({})
+
+const dashboardWidgetCatalogList = (): ToolBase<
+ typeof DashboardWidgetCatalogListSchema,
+ Schemas.WidgetCatalogResponse
+> => ({
+ name: 'dashboard-widget-catalog-list',
+ schema: DashboardWidgetCatalogListSchema,
+ // eslint-disable-next-line no-unused-vars
+ handler: async (context: Context, params: z.infer<typeof DashboardWidgetCatalogListSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.WidgetCatalogResponse>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/dashboards/widget_catalog/`,
+ })
+ return result
+ },
+})
+
+const DashboardWidgetsBatchAddSchema = DashboardsWidgetsBatchCreateParams.omit({ project_id: true })
+ .extend(DashboardsWidgetsBatchCreateBody.shape)
+ .extend({ id: z.preprocess(castStringToInt, DashboardsWidgetsBatchCreateParams.shape['id']) })
+
+const dashboardWidgetsBatchAdd = (): ToolBase<
+ typeof DashboardWidgetsBatchAddSchema,
+ WithPostHogUrl<Schemas.AddDashboardWidgetsBatchResponse>
+> => ({
+ name: 'dashboard-widgets-batch-add',
+ schema: DashboardWidgetsBatchAddSchema,
+ handler: async (context: Context, params: z.infer<typeof DashboardWidgetsBatchAddSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.widgets !== undefined) {
+ body['widgets'] = params.widgets
+ }
+ const result = await context.api.request<Schemas.AddDashboardWidgetsBatchResponse>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/dashboards/${encodeURIComponent(String(params.id))}/widgets/batch/`,
+ body,
+ })
+ return await withPostHogUrl(context, result, `/dashboard/${params.id}`)
+ },
+})
+
+const DashboardWidgetsRunSchema = DashboardsRunWidgetsRetrieveParams.omit({ project_id: true })
+ .extend(DashboardsRunWidgetsRetrieveQueryParams.omit({ format: true }).shape)
+ .extend({ id: z.preprocess(castStringToInt, DashboardsRunWidgetsRetrieveParams.shape['id']) })
+
+const dashboardWidgetsRun = (): ToolBase<
+ typeof DashboardWidgetsRunSchema,
+ WithPostHogUrl<Schemas.RunWidgetsResponse>
+> => ({
+ name: 'dashboard-widgets-run',
+ schema: DashboardWidgetsRunSchema,
+ handler: async (context: Context, params: z.infer<typeof DashboardWidgetsRunSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.RunWidgetsResponse>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/dashboards/${encodeURIComponent(String(params.id))}/run_widgets/`,
+ query: {
+ tile_ids: params.tile_ids,
+ },
+ })
+ return await withPostHogUrl(context, result, `/dashboard/${params.id}`)
+ },
+})
+
const DashboardsGetAllSchema = DashboardsListQueryParams.omit({ format: true }).extend({
limit: z.preprocess(castStringToInt, DashboardsListQueryParams.shape['limit']).optional(),
offset: z.preprocess(castStringToInt, DashboardsListQueryParams.shape['offset']).optional(),
@@ -480,6 +580,34 @@ const dashboardsGetAll = (): ToolBase<
},
})
+const DashboardsMoveTilePartialUpdateSchema = DashboardsMoveTilePartialUpdateParams.omit({ project_id: true })
+ .extend(DashboardsMoveTilePartialUpdateBody.shape)
+ .extend({ id: z.preprocess(castStringToInt, DashboardsMoveTilePartialUpdateParams.shape['id']) })
+
+const dashboardsMoveTilePartialUpdate = (): ToolBase<
+ typeof DashboardsMoveTilePartialUpdateSchema,
+ WithPostHogUrl<Schemas.Dashboard>
+> => ({
+ name: 'dashboards-move-tile-partial-update',
+ schema: DashboardsMoveTilePartialUpdateSchema,
+ handler: async (context: Context, params: z.infer<typeof DashboardsMoveTilePartialUpdateSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.to_dashboard !== undefined) {
+ body['to_dashboard'] = params.to_dashboard
+ }
+ if (params.tile !== undefined) {
+ body['tile'] = params.tile
+ }
+ const result = await context.api.request<Schemas.Dashboard>({
+ method: 'PATCH',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/dashboards/${encodeURIComponent(String(params.id))}/move_tile/`,
+ body,
+ })
+ return await withPostHogUrl(context, result, `/dashboard/${result.id}`)
+ },
+})
+
export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'dashboard-create': dashboardCreate,
'dashboard-create-text-tile': dashboardCreateTextTile,
@@ -488,7 +616,12 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'dashboard-get': dashboardGet,
'dashboard-insights-run': dashboardInsightsRun,
'dashboard-reorder-tiles': dashboardReorderTiles,
+ 'dashboard-tile-copy': dashboardTileCopy,
'dashboard-update': dashboardUpdate,
'dashboard-update-text-tile': dashboardUpdateTextTile,
+ 'dashboard-widget-catalog-list': dashboardWidgetCatalogList,
+ 'dashboard-widgets-batch-add': dashboardWidgetsBatchAdd,
+ 'dashboard-widgets-run': dashboardWidgetsRun,
'dashboards-get-all': dashboardsGetAll,
+ 'dashboards-move-tile-partial-update': dashboardsMoveTilePartialUpdate,
}
diff --git a/services/mcp/tests/tools/dashboards.integration.test.ts b/services/mcp/tests/tools/dashboards.integration.test.ts
index e4069bdc5894..32c218a32974 100644
--- a/services/mcp/tests/tools/dashboards.integration.test.ts
+++ b/services/mcp/tests/tools/dashboards.integration.test.ts
@@ -457,4 +457,72 @@ describe('Dashboards', { concurrent: false }, () => {
)
})
})
+
+ describe('dashboard widget tools', () => {
+ const catalogTool = getToolByName('dashboard-widget-catalog-list')
+ const batchAddWidgetTool = getToolByName('dashboard-widgets-batch-add')
+ const runWidgetsTool = getToolByName('dashboard-widgets-run')
+ const createTool = getToolByName('dashboard-create')
+ const getOneTool = getToolByName('dashboard-get')
+
+ it('dashboard-widget-catalog-list returns widget catalog entries', async () => {
+ const result = await catalogTool.handler(context, {})
+ const catalog = parseToolResponse(result)
+
+ expect(Array.isArray(catalog.results)).toBe(true)
+ const errorTracking = catalog.results.find(
+ (entry: { widget_type: string }) => entry.widget_type === 'error_tracking_list'
+ )
+ expect(errorTracking).toBeTruthy()
+ expect(errorTracking.config_schema_hints?.limit?.max).toBe(25)
+
+ const sessionReplay = catalog.results.find(
+ (entry: { widget_type: string }) => entry.widget_type === 'session_replay_list'
+ )
+ expect(sessionReplay).toBeTruthy()
+ expect(sessionReplay.config_schema_hints?.orderBy?.default).toBe('start_time')
+ })
+
+ it('dashboard-widgets-batch-add and dashboard-widgets-run workflow', async () => {
+ const dashboardResult = await createTool.handler(context, {
+ name: generateUniqueKey('Widget MCP Dashboard'),
+ pinned: false,
+ })
+ const dashboard = parseToolResponse(dashboardResult)
+ createdResources.dashboards.push(dashboard.id)
+
+ const addResult = await batchAddWidgetTool.handler(context, {
+ id: dashboard.id,
+ widgets: [
+ {
+ widget_type: 'error_tracking_list',
+ config: { limit: 5 },
+ },
+ ],
+ })
+
+ const batchResponse = parseToolResponse(addResult)
+ expect(Array.isArray(batchResponse.tiles)).toBe(true)
+ const tile = batchResponse.tiles[0]
+ expect(tile.id).toBeTruthy()
+ expect(tile.widget?.widget_type).toBe('error_tracking_list')
+ expect(batchResponse._posthogUrl).toContain(`/dashboard/${dashboard.id}`)
+
+ const dashboardWithTile = parseToolResponse(await getOneTool.handler(context, { id: dashboard.id }))
+ const widgetTile = dashboardWithTile.tiles?.find((t: { widget?: unknown }) => !!t.widget)
+ expect(widgetTile?.id).toBe(tile.id)
+
+ const runResult = await runWidgetsTool.handler(context, {
+ id: dashboard.id,
+ tile_ids: String(tile.id),
+ })
+ const runResponse = parseToolResponse(runResult)
+
+ expect(runResponse._posthogUrl).toContain(`/dashboard/${dashboard.id}`)
+ expect(Array.isArray(runResponse.results)).toBe(true)
+ expect(runResponse.results.length).toBe(1)
+ expect(runResponse.results[0].tile_id).toBe(tile.id)
+ expect(runResponse.results[0].widget_type).toBe('error_tracking_list')
+ })
+ })
})
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-tile-copy.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-tile-copy.json
new file mode 100644
index 000000000000..2da033f80708
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-tile-copy.json
@@ -0,0 +1,19 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "fromDashboardId": {
+ "description": "Dashboard id the tile currently belongs to.",
+ "type": "number"
+ },
+ "id": {
+ "description": "A unique integer value identifying this dashboard.",
+ "type": "number"
+ },
+ "tileId": {
+ "description": "Dashboard tile id to copy.",
+ "type": "number"
+ }
+ },
+ "required": ["id", "fromDashboardId", "tileId"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widget-catalog-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widget-catalog-list.json
new file mode 100644
index 000000000000..7b7ea9186078
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widget-catalog-list.json
@@ -0,0 +1,5 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {},
+ "type": "object"
+}
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.json
new file mode 100644
index 000000000000..af82e485f343
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-batch-add.json
@@ -0,0 +1,247 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "id": {
+ "description": "A unique integer value identifying this dashboard.",
+ "type": "number"
+ },
+ "widgets": {
+ "description": "Widget tiles to add atomically (1–10). Use a single-element list to add one widget.",
+ "items": {
+ "properties": {
+ "config": {
+ "anyOf": [
+ {
+ "properties": {
+ "dateRange": {
+ "anyOf": [
+ {
+ "properties": {
+ "date_from": {
+ "anyOf": [
+ {
+ "description": "* `-14d` - -14d\n* `-1h` - -1h\n* `-24h` - -24h\n* `-30d` - -30d\n* `-3h` - -3h\n* `-7d` - -7d\n* `-90d` - -90d",
+ "enum": [
+ "-14d",
+ "-1h",
+ "-24h",
+ "-30d",
+ "-3h",
+ "-7d",
+ "-90d"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Relative lookback window (for example '-7d'). Omit to use the project default range.\n\n* `-14d` - -14d\n* `-1h` - -1h\n* `-24h` - -24h\n* `-30d` - -30d\n* `-3h` - -3h\n* `-7d` - -7d\n* `-90d` - -90d"
+ }
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional relative date range override."
+ },
+ "filterTestAccounts": {
+ "description": "When omitted, follows the project default for filtering test accounts.",
+ "type": "boolean"
+ },
+ "limit": {
+ "default": 10,
+ "description": "Maximum number of issues to return.",
+ "maximum": 25,
+ "minimum": 1,
+ "type": "number"
+ },
+ "orderBy": {
+ "default": "occurrences",
+ "description": "Issue ranking column.\n\n* `first_seen` - first_seen\n* `last_seen` - last_seen\n* `occurrences` - occurrences\n* `sessions` - sessions\n* `users` - users",
+ "enum": ["last_seen", "first_seen", "occurrences", "users", "sessions"],
+ "type": "string"
+ },
+ "orderDirection": {
+ "default": "DESC",
+ "description": "Sort direction for orderBy.\n\n* `ASC` - ASC\n* `DESC` - DESC",
+ "enum": ["ASC", "DESC"],
+ "type": "string"
+ },
+ "status": {
+ "default": "active",
+ "description": "Issue status filter.\n\n* `archived` - archived\n* `active` - active\n* `resolved` - resolved\n* `pending_release` - pending_release\n* `suppressed` - suppressed\n* `all` - all",
+ "enum": [
+ "archived",
+ "active",
+ "resolved",
+ "pending_release",
+ "suppressed",
+ "all"
+ ],
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ {
+ "properties": {
+ "dateRange": {
+ "anyOf": [
+ {
+ "properties": {
+ "date_from": {
+ "anyOf": [
+ {
+ "description": "* `-14d` - -14d\n* `-1h` - -1h\n* `-24h` - -24h\n* `-30d` - -30d\n* `-3h` - -3h\n* `-7d` - -7d\n* `-90d` - -90d",
+ "enum": [
+ "-14d",
+ "-1h",
+ "-24h",
+ "-30d",
+ "-3h",
+ "-7d",
+ "-90d"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Relative lookback window (for example '-7d'). Omit to use the project default range.\n\n* `-14d` - -14d\n* `-1h` - -1h\n* `-24h` - -24h\n* `-30d` - -30d\n* `-3h` - -3h\n* `-7d` - -7d\n* `-90d` - -90d"
+ }
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional relative date range override."
+ },
+ "filterTestAccounts": {
+ "description": "When omitted, follows the project default for filtering test accounts.",
+ "type": "boolean"
+ },
+ "limit": {
+ "default": 10,
+ "description": "Maximum number of recordings to return.",
+ "maximum": 25,
+ "minimum": 1,
+ "type": "number"
+ },
+ "orderBy": {
+ "default": "start_time",
+ "description": "Recording ranking column.\n\n* `activity_score` - activity_score\n* `click_count` - click_count\n* `console_error_count` - console_error_count\n* `duration` - duration\n* `recording_duration` - recording_duration\n* `start_time` - start_time",
+ "enum": [
+ "activity_score",
+ "click_count",
+ "console_error_count",
+ "duration",
+ "recording_duration",
+ "start_time"
+ ],
+ "type": "string"
+ },
+ "orderDirection": {
+ "default": "DESC",
+ "description": "Sort direction for orderBy.\n\n* `ASC` - ASC\n* `DESC` - DESC",
+ "enum": ["ASC", "DESC"],
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ ],
+ "description": "Widget-specific configuration. Shape depends on widget_type; see dashboard-widget-catalog-list for config_schema_hints. Supported types: error_tracking_list, session_replay_list."
+ },
+ "description": {
+ "description": "Optional markdown description shown when show_description is enabled.",
+ "type": "string"
+ },
+ "layouts": {
+ "description": "Optional react-grid-layout positions keyed by breakpoint (sm, xs).",
+ "properties": {
+ "sm": {
+ "description": "Layout for the standard (desktop) breakpoint. The grid is 12 columns wide.",
+ "properties": {
+ "h": {
+ "description": "Height in grid rows.",
+ "type": "number"
+ },
+ "w": {
+ "description": "Width in grid columns. The desktop grid is 12 columns wide.",
+ "type": "number"
+ },
+ "x": {
+ "description": "Column position in the dashboard grid (0-indexed).",
+ "type": "number"
+ },
+ "y": {
+ "description": "Row position in the dashboard grid (0-indexed).",
+ "type": "number"
+ }
+ },
+ "type": "object"
+ },
+ "xs": {
+ "description": "Layout for the small (mobile) breakpoint. The grid is 1 column wide.",
+ "properties": {
+ "h": {
+ "description": "Height in grid rows.",
+ "type": "number"
+ },
+ "w": {
+ "description": "Width in grid columns. The desktop grid is 12 columns wide.",
+ "type": "number"
+ },
+ "x": {
+ "description": "Column position in the dashboard grid (0-indexed).",
+ "type": "number"
+ },
+ "y": {
+ "description": "Row position in the dashboard grid (0-indexed).",
+ "type": "number"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "name": {
+ "anyOf": [
+ {
+ "maxLength": 400,
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Optional custom display name for the widget tile."
+ },
+ "show_description": {
+ "description": "Whether to show the description on the dashboard tile.",
+ "type": "boolean"
+ },
+ "widget_type": {
+ "description": "Widget type identifier. Supported values: error_tracking_list, session_replay_list. Use dashboard-widget-catalog-list for config_schema_hints per type.",
+ "maxLength": 64,
+ "type": "string"
+ }
+ },
+ "required": ["widget_type", "config"],
+ "type": "object"
+ },
+ "maxItems": 10,
+ "minItems": 1,
+ "type": "array"
+ }
+ },
+ "required": ["id", "widgets"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-run.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-run.json
new file mode 100644
index 000000000000..d830b2b3c068
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboard-widgets-run.json
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "id": {
+ "description": "A unique integer value identifying this dashboard.",
+ "type": "number"
+ },
+ "tile_ids": {
+ "description": "Comma-separated dashboard tile IDs to run widgets for.",
+ "type": "string"
+ }
+ },
+ "required": ["id", "tile_ids"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboards-move-tile-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboards-move-tile-partial-update.json
new file mode 100644
index 000000000000..090dfe8d18e3
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/dashboards-move-tile-partial-update.json
@@ -0,0 +1,26 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "id": {
+ "description": "A unique integer value identifying this dashboard.",
+ "type": "number"
+ },
+ "tile": {
+ "description": "Tile to move, identified by its dashboard tile ID.",
+ "properties": {
+ "id": {
+ "description": "Dashboard tile ID to move.",
+ "type": "number"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+ },
+ "to_dashboard": {
+ "description": "Destination dashboard ID.",
+ "type": "number"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/tool-filtering.test.ts b/services/mcp/tests/unit/tool-filtering.test.ts
index 17f3e282f01f..4b271ba4dd1a 100644
--- a/services/mcp/tests/unit/tool-filtering.test.ts
+++ b/services/mcp/tests/unit/tool-filtering.test.ts
@@ -710,9 +710,10 @@ describe('Tool Filtering - Feature Flags', () => {
'replay-vision',
'tasks',
'promoted-product',
+ 'dashboard-widgets',
])
)
- expect(flags).toHaveLength(11)
+ expect(flags).toHaveLength(12)
})
// Exercise the real predicate (toolPassesFlagGate) over hand-rolled entries
diff --git a/services/mcp/tests/unit/tool-schema-snapshots.test.ts b/services/mcp/tests/unit/tool-schema-snapshots.test.ts
index 18110c8eefd4..da17c59953be 100644
--- a/services/mcp/tests/unit/tool-schema-snapshots.test.ts
+++ b/services/mcp/tests/unit/tool-schema-snapshots.test.ts
@@ -84,9 +84,9 @@ describe('Tool schema snapshots', () => {
it('snapshots runtime tool schemas', async () => {
const shouldUpdateSnapshots = isSnapshotUpdateAll()
const root = path.resolve(__dirname, '__snapshots__', 'tool-schemas')
- // Enable flag-gated tools we snapshot here: agent-feedback, tracing (APM spans), tasks. Other
- // flag-gated tools (logs-alerts, visual-review, etc.) stay off to keep the surface stable.
- const featureFlags = { 'mcp-feedback-tool': true, tracing: true, tasks: true }
+ // Enable flag-gated tools we snapshot here: agent-feedback, tracing (APM spans), tasks,
+ // dashboard-widgets. Other flag-gated tools (logs-alerts, visual-review, etc.) stay off to keep the surface stable.
+ const featureFlags = { 'mcp-feedback-tool': true, tracing: true, tasks: true, 'dashboard-widgets': true }
const tools = [...(await getToolsFromContext(context, { featureFlags }))].sort((a, b) =>
a.name.localeCompare(b.name)
)