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): filter the widget catalog by widget type (#120987)

Thomas Obermüllera86f8ec4a489
diff --git a/products/dashboards/backend/api/dashboard.py b/products/dashboards/backend/api/dashboard.py
index bf54959a2e39..30e92026a585 100644
--- a/products/dashboards/backend/api/dashboard.py
+++ b/products/dashboards/backend/api/dashboard.py
@@ -165,7 +165,7 @@ from products.dashboards.backend.widget_access import (
get_widget_product_access_error,
)
from products.dashboards.backend.widget_availability import get_widget_feature_enabled
-from products.dashboards.backend.widget_catalog import get_widget_catalog_entries
+from products.dashboards.backend.widget_catalog import get_widget_catalog_entries, parse_widget_type_filter
from products.dashboards.backend.widget_create import create_widget_tile, prepare_widget_tile_create
from products.dashboards.backend.widget_layouts import collect_dashboard_sm_layouts_for_dashboard
from products.dashboards.backend.widget_query_throttle import get_dashboard_widget_query_throttle_error
@@ -3871,11 +3871,26 @@ class DashboardsViewSet(
return Response({"results": results})
- @extend_schema(responses={200: WidgetCatalogResponseSerializer})
+ @extend_schema(
+ parameters=[
+ OpenApiParameter(
+ name="widget_type",
+ type=str,
+ enum=sorted(EXPECTED_WIDGET_TYPES),
+ many=True,
+ style="form",
+ explode=False,
+ required=False,
+ description="Widget types to return. Omit to return every registered widget type.",
+ ),
+ ],
+ responses={200: WidgetCatalogResponseSerializer},
+ )
@action(methods=["GET"], detail=False, required_scopes=["dashboard:read"])
def widget_catalog(self, request: Request, *args: Any, **kwargs: Any) -> Response:
"""List registered dashboard widget types and per-type config_schema documentation for agents."""
- return Response({"results": get_widget_catalog_entries()})
+ widget_types = parse_widget_type_filter(request.query_params.getlist("widget_type"))
+ return Response({"results": get_widget_catalog_entries(widget_types)})
@extend_schema(
request=AddDashboardWidgetsBatchRequestOpenApiSerializer,
diff --git a/products/dashboards/backend/api/test/test_dashboard_widgets.py b/products/dashboards/backend/api/test/test_dashboard_widgets.py
index 4e44dd0c6e0f..1be89001832f 100644
--- a/products/dashboards/backend/api/test/test_dashboard_widgets.py
+++ b/products/dashboards/backend/api/test/test_dashboard_widgets.py
@@ -537,6 +537,27 @@ class TestDashboardWidgets(APIBaseTest):
assert error_tracking_list["config_schema"]["properties"]["limit"]["default"] == DEFAULT_WIDGET_LIST_LIMIT
assert error_tracking_list["availability_requirements"] == ["exception_autocapture"]
+ @parameterized.expand(
+ [
+ ("single_type", "?widget_type=logs_list", {"logs_list"}),
+ ("comma_separated", "?widget_type=logs_list,survey_results", {"logs_list", "survey_results"}),
+ ("repeated_param", "?widget_type=logs_list&widget_type=survey_results", {"logs_list", "survey_results"}),
+ ]
+ )
+ @override_settings(IN_UNIT_TESTING=True)
+ def test_widget_catalog_filters_by_widget_type(self, _name: str, query: str, expected: set[str]) -> None:
+ response = self.client.get(f"/api/projects/{self.team.id}/dashboards/widget_catalog/{query}")
+ assert response.status_code == status.HTTP_200_OK
+ assert {entry["widget_type"] for entry in response.json()["results"]} == expected
+
+ @override_settings(IN_UNIT_TESTING=True)
+ def test_widget_catalog_rejects_unknown_widget_type(self) -> None:
+ response = self.client.get(
+ f"/api/projects/{self.team.id}/dashboards/widget_catalog/?widget_type=logs_list,not_a_widget"
+ )
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ assert "not_a_widget" in response.json()["detail"]
+
@override_settings(IN_UNIT_TESTING=True)
def test_add_widget_via_batch_endpoint(self) -> None:
dashboard_id, _ = self.dashboard_api.create_dashboard({"name": "dashboard"})
diff --git a/products/dashboards/backend/widget_catalog.py b/products/dashboards/backend/widget_catalog.py
index 6fdeb9a2b8f4..0f9acd64e04d 100644
--- a/products/dashboards/backend/widget_catalog.py
+++ b/products/dashboards/backend/widget_catalog.py
@@ -1,7 +1,10 @@
from __future__ import annotations
+from collections.abc import Sequence
from typing import Any, NotRequired, TypedDict
+from rest_framework import exceptions
+
from products.dashboards.backend.widget_specs.registry import WIDGET_SPECS
@@ -39,8 +42,25 @@ WIDGET_CATALOG: dict[str, WidgetCatalogEntry] = {
}
-def get_widget_catalog_entries() -> list[WidgetCatalogEntry]:
- return list(WIDGET_CATALOG.values())
+def get_widget_catalog_entries(widget_types: Sequence[str] | None = None) -> list[WidgetCatalogEntry]:
+ if not widget_types:
+ return list(WIDGET_CATALOG.values())
+ requested = set(widget_types)
+ return [entry for widget_type, entry in WIDGET_CATALOG.items() if widget_type in requested]
+
+
+def parse_widget_type_filter(raw_values: Sequence[str]) -> list[str]:
+ """Parse `widget_type` query values. Each value can hold one type or a comma-separated list."""
+ widget_types = list(dict.fromkeys(part.strip() for raw in raw_values for part in raw.split(",") if part.strip()))
+ unknown = [widget_type for widget_type in widget_types if widget_type not in WIDGET_CATALOG]
+ if unknown:
+ raise exceptions.ValidationError(
+ {
+ "widget_type": f"Unknown widget type: {', '.join(unknown)}. "
+ f"Valid types: {', '.join(sorted(WIDGET_CATALOG))}."
+ }
+ )
+ return widget_types
def get_widget_product_access_denied_message(required_product_access: str) -> str:
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index 0490c03fab46..d248b9cbf568 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -10942,6 +10942,10 @@ export const DashboardsCreateUnlistedDashboardCreateFormat = {
export type DashboardsWidgetCatalogRetrieveParams = {
format?: DashboardsWidgetCatalogRetrieveFormat
+ /**
+ * Widget types to return. Omit to return every registered widget type.
+ */
+ widget_type?: DashboardsWidgetCatalogRetrieveWidgetTypeItem[]
}
export type DashboardsWidgetCatalogRetrieveFormat =
@@ -10952,6 +10956,22 @@ export const DashboardsWidgetCatalogRetrieveFormat = {
Txt: 'txt',
} as const
+export type DashboardsWidgetCatalogRetrieveWidgetTypeItem =
+ (typeof DashboardsWidgetCatalogRetrieveWidgetTypeItem)[keyof typeof DashboardsWidgetCatalogRetrieveWidgetTypeItem]
+
+export const DashboardsWidgetCatalogRetrieveWidgetTypeItem = {
+ ActivityEventsList: 'activity_events_list',
+ CanvasApp: 'canvas_app',
+ ConversationsRecentTickets: 'conversations_recent_tickets',
+ ErrorTrackingList: 'error_tracking_list',
+ ExperimentResults: 'experiment_results',
+ ExperimentsList: 'experiments_list',
+ LogsList: 'logs_list',
+ NotebookWidget: 'notebook_widget',
+ SessionReplayList: 'session_replay_list',
+ SurveyResults: 'survey_results',
+} as const
+
export type DataColorThemesListParams = {
/**
* Number of results to return per page.
diff --git a/products/dashboards/mcp/tools.yaml b/products/dashboards/mcp/tools.yaml
index 73e4a1bf3b3d..478e3cb3a527 100644
--- a/products/dashboards/mcp/tools.yaml
+++ b/products/dashboards/mcp/tools.yaml
@@ -561,10 +561,11 @@ tools:
idempotent: true
title: List dashboard widget catalog
description: >
- List registered dashboard widget types with labels, descriptions, and per-type config_schema. Use before
- dashboard-widgets-batch-add to pick a widget_type and shape config. Each type documents its own config keys
- under config_schema (shared keys include limit, orderBy, orderDirection, dateRange, filterTestAccounts, and
- optional widgetFilters).
+ List registered dashboard widget types with labels, descriptions, and per-type config_schema. Pass
+ `widget_type` (one type or a list) to get only the types you will write; the full catalog is large, so omit
+ it only when you still need to pick a type. The valid `widget_type` values are listed in this tool's schema.
+ Each type documents its own config keys under config_schema (shared keys include limit, orderBy,
+ orderDirection, dateRange, filterTestAccounts, and optional widgetFilters).
dashboard-widgets-batch-add:
operation: dashboards_widgets_batch_create
enabled: true
@@ -577,14 +578,15 @@ tools:
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. Pass `widgets` as an
- array of payloads (widget_type, config, optional name, description, layouts). This schema does not list
- config keys: build each config from the config_schema of its widget_type in the catalog. widgetFilters, when
- supported, is a map of filter id to property filter entries. An invalid config returns a 400 that names each
- invalid field. 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. This only adds new
- tiles — to edit existing widget tiles, use dashboard-widgets-batch-update (no delete-and-re-add needed).
+ Add widget tiles to a dashboard atomically via POST .../widgets/batch/ (1–10 tiles). Before writing a
+ config, call dashboard-widget-catalog-list with `widget_type` set to the types you will add, to read their
+ config_schema. The valid widget_type values are in this tool's schema. Pass `widgets` as an array of
+ payloads (widget_type, config, optional name, description, layouts). This schema does not list config keys:
+ build each config from the config_schema of its widget_type in the catalog. widgetFilters, when supported,
+ is a map of filter id to property filter entries. An invalid config returns a 400 that names each invalid
+ field. 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. This only adds new tiles —
+ to edit existing widget tiles, use dashboard-widgets-batch-update (no delete-and-re-add needed).
param_overrides:
id:
cast: string-int
@@ -605,9 +607,10 @@ tools:
by its DashboardTile `tile_id` (use dashboard-get to look up widget tile IDs) plus the settings to change.
Only the fields you provide per widget are updated; omitted fields are left unchanged. A config update
replaces only the top-level keys you send. This schema does not list config keys: read the config_schema of
- the tile's widget_type from dashboard-widget-catalog-list. All updates succeed or fail together. Tile
- placement (layout, show_description) is not changed here — use dashboard-update or dashboard-reorder-tiles
- for that. To add new widgets, use dashboard-widgets-batch-add; to remove one, use dashboard-delete-tile.
+ the tile's widget_type from dashboard-widget-catalog-list, passing `widget_type` to fetch only that type.
+ All updates succeed or fail together. Tile placement (layout, show_description) is not changed here — use
+ dashboard-update or dashboard-reorder-tiles for that. To add new widgets, use dashboard-widgets-batch-add;
+ to remove one, use dashboard-delete-tile.
param_overrides:
id:
cast: string-int
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index e9bd82fb9f42..5f526492c2c2 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -3900,7 +3900,7 @@
}
},
"dashboard-widget-catalog-list": {
- "description": "List registered dashboard widget types with labels, descriptions, and per-type config_schema. Use before dashboard-widgets-batch-add to pick a widget_type and shape config. Each type documents its own config keys under config_schema (shared keys include limit, orderBy, orderDirection, dateRange, filterTestAccounts, and optional widgetFilters).",
+ "description": "List registered dashboard widget types with labels, descriptions, and per-type config_schema. Pass `widget_type` (one type or a list) to get only the types you will write; the full catalog is large, so omit it only when you still need to pick a type. The valid `widget_type` values are listed in this tool's schema. Each type documents its own config keys under config_schema (shared keys include limit, orderBy, orderDirection, dateRange, filterTestAccounts, and optional widgetFilters).",
"category": "Dashboards",
"feature": "dashboards",
"summary": "List dashboard widget catalog",
@@ -3915,7 +3915,7 @@
}
},
"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. Pass `widgets` as an array of payloads (widget_type, config, optional name, description, layouts). This schema does not list config keys: build each config from the config_schema of its widget_type in the catalog. widgetFilters, when supported, is a map of filter id to property filter entries. An invalid config returns a 400 that names each invalid field. 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. This only adds new tiles — to edit existing widget tiles, use dashboard-widgets-batch-update (no delete-and-re-add needed).",
+ "description": "Add widget tiles to a dashboard atomically via POST .../widgets/batch/ (1–10 tiles). Before writing a config, call dashboard-widget-catalog-list with `widget_type` set to the types you will add, to read their config_schema. The valid widget_type values are in this tool's schema. Pass `widgets` as an array of payloads (widget_type, config, optional name, description, layouts). This schema does not list config keys: build each config from the config_schema of its widget_type in the catalog. widgetFilters, when supported, is a map of filter id to property filter entries. An invalid config returns a 400 that names each invalid field. 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. This only adds new tiles — to edit existing widget tiles, use dashboard-widgets-batch-update (no delete-and-re-add needed).",
"category": "Dashboards",
"feature": "dashboards",
"summary": "Add dashboard widgets",
@@ -3930,7 +3930,7 @@
}
},
"dashboard-widgets-batch-update": {
- "description": "Update the settings of existing widgets in place atomically (1–10), without delete-and-re-add. Edits widget settings only — `config`, `name`, and `description`. Pass `widgets` as an array of payloads, each identified by its DashboardTile `tile_id` (use dashboard-get to look up widget tile IDs) plus the settings to change. Only the fields you provide per widget are updated; omitted fields are left unchanged. A config update replaces only the top-level keys you send. This schema does not list config keys: read the config_schema of the tile's widget_type from dashboard-widget-catalog-list. All updates succeed or fail together. Tile placement (layout, show_description) is not changed here — use dashboard-update or dashboard-reorder-tiles for that. To add new widgets, use dashboard-widgets-batch-add; to remove one, use dashboard-delete-tile.",
+ "description": "Update the settings of existing widgets in place atomically (1–10), without delete-and-re-add. Edits widget settings only — `config`, `name`, and `description`. Pass `widgets` as an array of payloads, each identified by its DashboardTile `tile_id` (use dashboard-get to look up widget tile IDs) plus the settings to change. Only the fields you provide per widget are updated; omitted fields are left unchanged. A config update replaces only the top-level keys you send. This schema does not list config keys: read the config_schema of the tile's widget_type from dashboard-widget-catalog-list, passing `widget_type` to fetch only that type. All updates succeed or fail together. Tile placement (layout, show_description) is not changed here — use dashboard-update or dashboard-reorder-tiles for that. To add new widgets, use dashboard-widgets-batch-add; to remove one, use dashboard-delete-tile.",
"category": "Dashboards",
"feature": "dashboards",
"summary": "Update dashboard widget settings",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 33751f69c54a..7dad6976e964 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -3915,7 +3915,7 @@
}
},
"dashboard-widget-catalog-list": {
- "description": "List registered dashboard widget types with labels, descriptions, and per-type config_schema. Use before dashboard-widgets-batch-add to pick a widget_type and shape config. Each type documents its own config keys under config_schema (shared keys include limit, orderBy, orderDirection, dateRange, filterTestAccounts, and optional widgetFilters).",
+ "description": "List registered dashboard widget types with labels, descriptions, and per-type config_schema. Pass `widget_type` (one type or a list) to get only the types you will write; the full catalog is large, so omit it only when you still need to pick a type. The valid `widget_type` values are listed in this tool's schema. Each type documents its own config keys under config_schema (shared keys include limit, orderBy, orderDirection, dateRange, filterTestAccounts, and optional widgetFilters).",
"category": "Dashboards",
"feature": "dashboards",
"summary": "List dashboard widget catalog",
@@ -3930,7 +3930,7 @@
}
},
"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. Pass `widgets` as an array of payloads (widget_type, config, optional name, description, layouts). This schema does not list config keys: build each config from the config_schema of its widget_type in the catalog. widgetFilters, when supported, is a map of filter id to property filter entries. An invalid config returns a 400 that names each invalid field. 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. This only adds new tiles — to edit existing widget tiles, use dashboard-widgets-batch-update (no delete-and-re-add needed).",
+ "description": "Add widget tiles to a dashboard atomically via POST .../widgets/batch/ (1–10 tiles). Before writing a config, call dashboard-widget-catalog-list with `widget_type` set to the types you will add, to read their config_schema. The valid widget_type values are in this tool's schema. Pass `widgets` as an array of payloads (widget_type, config, optional name, description, layouts). This schema does not list config keys: build each config from the config_schema of its widget_type in the catalog. widgetFilters, when supported, is a map of filter id to property filter entries. An invalid config returns a 400 that names each invalid field. 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. This only adds new tiles — to edit existing widget tiles, use dashboard-widgets-batch-update (no delete-and-re-add needed).",
"category": "Dashboards",
"feature": "dashboards",
"summary": "Add dashboard widgets",
@@ -3945,7 +3945,7 @@
}
},
"dashboard-widgets-batch-update": {
- "description": "Update the settings of existing widgets in place atomically (1–10), without delete-and-re-add. Edits widget settings only — `config`, `name`, and `description`. Pass `widgets` as an array of payloads, each identified by its DashboardTile `tile_id` (use dashboard-get to look up widget tile IDs) plus the settings to change. Only the fields you provide per widget are updated; omitted fields are left unchanged. A config update replaces only the top-level keys you send. This schema does not list config keys: read the config_schema of the tile's widget_type from dashboard-widget-catalog-list. All updates succeed or fail together. Tile placement (layout, show_description) is not changed here — use dashboard-update or dashboard-reorder-tiles for that. To add new widgets, use dashboard-widgets-batch-add; to remove one, use dashboard-delete-tile.",
+ "description": "Update the settings of existing widgets in place atomically (1–10), without delete-and-re-add. Edits widget settings only — `config`, `name`, and `description`. Pass `widgets` as an array of payloads, each identified by its DashboardTile `tile_id` (use dashboard-get to look up widget tile IDs) plus the settings to change. Only the fields you provide per widget are updated; omitted fields are left unchanged. A config update replaces only the top-level keys you send. This schema does not list config keys: read the config_schema of the tile's widget_type from dashboard-widget-catalog-list, passing `widget_type` to fetch only that type. All updates succeed or fail together. Tile placement (layout, show_description) is not changed here — use dashboard-update or dashboard-reorder-tiles for that. To add new widgets, use dashboard-widgets-batch-add; to remove one, use dashboard-delete-tile.",
"category": "Dashboards",
"feature": "dashboards",
"summary": "Update dashboard widget settings",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 1284e06af69b..060f5ef4bb17 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -125571,6 +125571,10 @@ export namespace Schemas {
export type DashboardsWidgetCatalogRetrieveParams = {
format?: DashboardsWidgetCatalogRetrieveFormat;
+ /**
+ * Widget types to return. Omit to return every registered widget type.
+ */
+ widget_type?: DashboardsWidgetCatalogRetrieveWidgetTypeItem[];
};
export type DashboardsWidgetCatalogRetrieveFormat = typeof DashboardsWidgetCatalogRetrieveFormat[keyof typeof DashboardsWidgetCatalogRetrieveFormat];
@@ -125581,6 +125585,22 @@ export namespace Schemas {
Txt: 'txt',
} as const;
+ export type DashboardsWidgetCatalogRetrieveWidgetTypeItem = typeof DashboardsWidgetCatalogRetrieveWidgetTypeItem[keyof typeof DashboardsWidgetCatalogRetrieveWidgetTypeItem];
+
+
+ export const DashboardsWidgetCatalogRetrieveWidgetTypeItem = {
+ ActivityEventsList: 'activity_events_list',
+ CanvasApp: 'canvas_app',
+ ConversationsRecentTickets: 'conversations_recent_tickets',
+ ErrorTrackingList: 'error_tracking_list',
+ ExperimentResults: 'experiment_results',
+ ExperimentsList: 'experiments_list',
+ LogsList: 'logs_list',
+ NotebookWidget: 'notebook_widget',
+ SessionReplayList: 'session_replay_list',
+ SurveyResults: 'survey_results',
+ } as const;
+
export type DataCatalogCertificationsListParams = {
/**
* Number of results to return per page.
diff --git a/services/mcp/src/generated/dashboards/api.ts b/services/mcp/src/generated/dashboards/api.ts
index f7c2e4f1ec7b..b29738588188 100644
--- a/services/mcp/src/generated/dashboards/api.ts
+++ b/services/mcp/src/generated/dashboards/api.ts
@@ -1036,4 +1036,21 @@ export const DashboardsWidgetCatalogRetrieveParams = () => zod.object({
export const DashboardsWidgetCatalogRetrieveQueryParams = () => zod.object({
format: zod.enum(['json', 'txt']).optional(),
+ widget_type: zod
+ .array(
+ zod.enum([
+ 'activity_events_list',
+ 'canvas_app',
+ 'conversations_recent_tickets',
+ 'error_tracking_list',
+ 'experiment_results',
+ 'experiments_list',
+ 'logs_list',
+ 'notebook_widget',
+ 'session_replay_list',
+ 'survey_results',
+ ])
+ )
+ .optional()
+ .describe('Widget types to return. Omit to return every registered widget type.'),
})
diff --git a/services/mcp/src/tools/generated/dashboards.ts b/services/mcp/src/tools/generated/dashboards.ts
index 03bec81389cd..15390ad609ca 100644
--- a/services/mcp/src/tools/generated/dashboards.ts
+++ b/services/mcp/src/tools/generated/dashboards.ts
@@ -736,7 +736,10 @@ const dashboardUpdateTextTile = (): ToolBase<
},
})
-const DashboardWidgetCatalogListSchema = () => z.object({})
+const DashboardWidgetCatalogListSchema = () => {
+ const DashboardsWidgetCatalogRetrieveQueryParams = orvalSchemas.DashboardsWidgetCatalogRetrieveQueryParams()
+ return DashboardsWidgetCatalogRetrieveQueryParams.omit({ format: true })
+}
const dashboardWidgetCatalogList = (): ToolBase<
ReturnType<typeof DashboardWidgetCatalogListSchema>,
@@ -744,11 +747,16 @@ const dashboardWidgetCatalogList = (): ToolBase<
> => ({
name: 'dashboard-widget-catalog-list',
schema: DashboardWidgetCatalogListSchema(),
- handler: async (context: Context, _params: z.infer<ReturnType<typeof DashboardWidgetCatalogListSchema>>) => {
+ handler: async (context: Context, params: z.infer<ReturnType<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/`,
+ query: {
+ widget_type: Array.isArray(params.widget_type)
+ ? params.widget_type.join(',') || undefined
+ : params.widget_type,
+ },
})
return result
},
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
index 7b7ea9186078..b029d140af48 100644
--- 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
@@ -1,5 +1,25 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
- "properties": {},
+ "properties": {
+ "widget_type": {
+ "description": "Widget types to return. Omit to return every registered widget type.",
+ "items": {
+ "enum": [
+ "activity_events_list",
+ "canvas_app",
+ "conversations_recent_tickets",
+ "error_tracking_list",
+ "experiment_results",
+ "experiments_list",
+ "logs_list",
+ "notebook_widget",
+ "session_replay_list",
+ "survey_results"
+ ],
+ "type": "string"
+ },
+ "type": "array"
+ }
+ },
"type": "object"
}