:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(mcp-analytics): move tool call breakdown to a query runner (#74565)
Georgis Andonis3d4d6ff37e27
diff --git a/bin/patch-schema-property-filter-discriminator.py b/bin/patch-schema-property-filter-discriminator.pyindex deac8bccec9a..4e8d1c91cacb 100644--- a/bin/patch-schema-property-filter-discriminator.py+++ b/bin/patch-schema-property-filter-discriminator.py@@ -72,7 +72,7 @@ EXPECTED_SITE_COUNTS = {# recursive site, discriminated including the group via its AND/OR -> property_group tag."recursive": 1,# Plain inlined runs: list[<members>], optionally `| PropertyGroupFilter` / `| None`.- "plain": 62,+ "plain": 63,}diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.jsonindex ae869554278d..76602fc77929 100644--- a/frontend/src/queries/schema.json+++ b/frontend/src/queries/schema.json@@ -1020,6 +1020,9 @@{"$ref": "#/definitions/EndpointsUsageTrendsQuery"},+ {+ "$ref": "#/definitions/MCPToolCallBreakdownQuery"+ },{"$ref": "#/definitions/MCPToolCallsAndErrorsQuery"},@@ -8522,6 +8525,106 @@],"type": "object"},+ "CachedMCPToolCallBreakdownQueryResponse": {+ "additionalProperties": false,+ "properties": {+ "cache_key": {+ "type": "string"+ },+ "cache_target_age": {+ "format": "date-time",+ "type": "string"+ },+ "calculation_trigger": {+ "description": "What triggered the calculation of the query, leave empty if user/immediate",+ "type": "string"+ },+ "error": {+ "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",+ "type": "string"+ },+ "hogql": {+ "description": "Generated HogQL query.",+ "type": "string"+ },+ "is_cached": {+ "type": "boolean"+ },+ "last_refresh": {+ "format": "date-time",+ "type": "string"+ },+ "modifiers": {+ "$ref": "#/definitions/HogQLQueryModifiers",+ "description": "Modifiers used when performing the query"+ },+ "next_allowed_client_refresh": {+ "format": "date-time",+ "type": "string"+ },+ "query_metadata": {+ "type": "object"+ },+ "query_status": {+ "$ref": "#/definitions/QueryStatus",+ "description": "Query status indicates whether next to the provided data, a query is still running."+ },+ "resolved_compare_date_range": {+ "$ref": "#/definitions/ResolvedDateRangeResponse",+ "description": "The resolved previous/comparison period date range, when comparing against another period"+ },+ "resolved_date_range": {+ "$ref": "#/definitions/ResolvedDateRangeResponse",+ "description": "The date range used for the query"+ },+ "results": {+ "items": {+ "$ref": "#/definitions/MCPToolCallBreakdownItem"+ },+ "type": "array"+ },+ "timezone": {+ "type": "string"+ },+ "timings": {+ "description": "Measured timings for different parts of the query generation process",+ "items": {+ "$ref": "#/definitions/QueryTiming"+ },+ "type": "array"+ },+ "used_data_warehouse_sources": {+ "description": "Connector-synced data warehouse sources referenced by this query, if any.",+ "items": {+ "$ref": "#/definitions/DataWarehouseSourceUsage"+ },+ "type": "array"+ },+ "warnings": {+ "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",+ "items": {+ "anyOf": [+ {+ "$ref": "#/definitions/DataWarehouseSyncWarning"+ },+ {+ "$ref": "#/definitions/AccessControlFilterWarning"+ }+ ]+ },+ "type": "array"+ }+ },+ "required": [+ "cache_key",+ "is_cached",+ "last_refresh",+ "next_allowed_client_refresh",+ "results",+ "timezone"+ ],+ "type": "object"+ },"CachedMCPToolCallsAndErrorsQueryResponse": {"additionalProperties": false,"properties": {@@ -29383,6 +29486,131 @@"required": ["results"],"type": "object"},+ "MCPToolCallBreakdownItem": {+ "additionalProperties": false,+ "description": "One tool's call count within one interval bucket.",+ "properties": {+ "bucket": {+ "description": "Bucket start as a project-timezone wall clock (\"YYYY-MM-DD HH:mm:ss\"), never zone-stamped, so the client can join it against generated axis keys without reinterpreting it as an instant.",+ "type": "string"+ },+ "calls": {+ "$ref": "#/definitions/integer"+ },+ "tool": {+ "type": "string"+ }+ },+ "required": ["bucket", "tool", "calls"],+ "type": "object"+ },+ "MCPToolCallBreakdownQuery": {+ "additionalProperties": false,+ "description": "Interval-bucketed call counts per tool, powering the dashboard's \"Tool call breakdown\" chart.",+ "properties": {+ "dateRange": {+ "$ref": "#/definitions/DateRange"+ },+ "filterTestAccounts": {+ "type": "boolean"+ },+ "interval": {+ "$ref": "#/definitions/IntervalType",+ "description": "Bucket granularity; the frontend passes getDefaultInterval. Defaults to day."+ },+ "kind": {+ "const": "MCPToolCallBreakdownQuery",+ "type": "string"+ },+ "modifiers": {+ "$ref": "#/definitions/HogQLQueryModifiers",+ "description": "Modifiers used when performing the query"+ },+ "properties": {+ "items": {+ "$ref": "#/definitions/AnyPropertyFilter"+ },+ "type": "array"+ },+ "response": {+ "$ref": "#/definitions/MCPToolCallBreakdownQueryResponse"+ },+ "tags": {+ "$ref": "#/definitions/QueryLogTags"+ },+ "version": {+ "description": "version of the node, used for schema migrations",+ "type": "number"+ }+ },+ "required": ["kind"],+ "type": "object"+ },+ "MCPToolCallBreakdownQueryResponse": {+ "additionalProperties": false,+ "properties": {+ "error": {+ "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",+ "type": "string"+ },+ "hogql": {+ "description": "Generated HogQL query.",+ "type": "string"+ },+ "modifiers": {+ "$ref": "#/definitions/HogQLQueryModifiers",+ "description": "Modifiers used when performing the query"+ },+ "query_status": {+ "$ref": "#/definitions/QueryStatus",+ "description": "Query status indicates whether next to the provided data, a query is still running."+ },+ "resolved_compare_date_range": {+ "$ref": "#/definitions/ResolvedDateRangeResponse",+ "description": "The resolved previous/comparison period date range, when comparing against another period"+ },+ "resolved_date_range": {+ "$ref": "#/definitions/ResolvedDateRangeResponse",+ "description": "The date range used for the query"+ },+ "results": {+ "items": {+ "$ref": "#/definitions/MCPToolCallBreakdownItem"+ },+ "type": "array"+ },+ "timings": {+ "description": "Measured timings for different parts of the query generation process",+ "items": {+ "$ref": "#/definitions/QueryTiming"+ },+ "type": "array"+ },+ "used_data_warehouse_sources": {+ "description": "Connector-synced data warehouse sources referenced by this query, if any.",+ "items": {+ "$ref": "#/definitions/DataWarehouseSourceUsage"+ },+ "type": "array"+ },+ "warnings": {+ "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",+ "items": {+ "anyOf": [+ {+ "$ref": "#/definitions/DataWarehouseSyncWarning"+ },+ {+ "$ref": "#/definitions/AccessControlFilterWarning"+ }+ ]+ },+ "type": "array"+ }+ },+ "required": ["results"],+ "type": "object"+ },"MCPToolCallsAndErrorsItem": {"additionalProperties": false,"description": "One interval bucket of MCP tool-call activity, split into successful and failed calls.",@@ -34332,6 +34560,7 @@"EndpointsUsageOverviewQuery","EndpointsUsageTableQuery","EndpointsUsageTrendsQuery",+ "MCPToolCallBreakdownQuery","MCPToolCallsAndErrorsQuery","MCPHarnessBreakdownQuery","MCPToolTopUsersQuery",@@ -42280,6 +42509,71 @@"required": ["results"],"type": "object"},+ {+ "additionalProperties": false,+ "properties": {+ "error": {+ "description": "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise.",+ "type": "string"+ },+ "hogql": {+ "description": "Generated HogQL query.",+ "type": "string"+ },+ "modifiers": {+ "$ref": "#/definitions/HogQLQueryModifiers",+ "description": "Modifiers used when performing the query"+ },+ "query_status": {+ "$ref": "#/definitions/QueryStatus",+ "description": "Query status indicates whether next to the provided data, a query is still running."+ },+ "resolved_compare_date_range": {+ "$ref": "#/definitions/ResolvedDateRangeResponse",+ "description": "The resolved previous/comparison period date range, when comparing against another period"+ },+ "resolved_date_range": {+ "$ref": "#/definitions/ResolvedDateRangeResponse",+ "description": "The date range used for the query"+ },+ "results": {+ "items": {+ "$ref": "#/definitions/MCPToolCallBreakdownItem"+ },+ "type": "array"+ },+ "timings": {+ "description": "Measured timings for different parts of the query generation process",+ "items": {+ "$ref": "#/definitions/QueryTiming"+ },+ "type": "array"+ },+ "used_data_warehouse_sources": {+ "description": "Connector-synced data warehouse sources referenced by this query, if any.",+ "items": {+ "$ref": "#/definitions/DataWarehouseSourceUsage"+ },+ "type": "array"+ },+ "warnings": {+ "description": "Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access.",+ "items": {+ "anyOf": [+ {+ "$ref": "#/definitions/DataWarehouseSyncWarning"+ },+ {+ "$ref": "#/definitions/AccessControlFilterWarning"+ }+ ]+ },+ "type": "array"+ }+ },+ "required": ["results"],+ "type": "object"+ },{"additionalProperties": false,"properties": {@@ -43488,6 +43782,9 @@{"$ref": "#/definitions/EndpointsUsageTrendsQuery"},+ {+ "$ref": "#/definitions/MCPToolCallBreakdownQuery"+ },{"$ref": "#/definitions/MCPToolCallsAndErrorsQuery"},diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.tsindex 05c4202c8159..783fcab85e7b 100644--- a/frontend/src/queries/schema/schema-general.ts+++ b/frontend/src/queries/schema/schema-general.ts@@ -187,6 +187,7 @@ export enum NodeKind {EndpointsUsageTrendsQuery = 'EndpointsUsageTrendsQuery',// MCP analytics+ MCPToolCallBreakdownQuery = 'MCPToolCallBreakdownQuery',MCPToolCallsAndErrorsQuery = 'MCPToolCallsAndErrorsQuery',MCPHarnessBreakdownQuery = 'MCPHarnessBreakdownQuery',MCPToolTopUsersQuery = 'MCPToolTopUsersQuery',@@ -264,6 +265,7 @@ export type AnyDataNode =| EndpointsUsageOverviewQuery| EndpointsUsageTableQuery| EndpointsUsageTrendsQuery+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery@@ -387,6 +389,7 @@ export type QuerySchema =| EndpointsUsageTrendsQuery// MCP analytics+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery@@ -2678,6 +2681,31 @@ export interface WebOverviewQueryResponse extends AnalyticsQueryResponseBase {export type CachedWebOverviewQueryResponse = CachedQueryResponse<WebOverviewQueryResponse>+/** One tool's call count within one interval bucket. */+export interface MCPToolCallBreakdownItem {+ /** Bucket start as a project-timezone wall clock ("YYYY-MM-DD HH:mm:ss"), never zone-stamped, so+ * the client can join it against generated axis keys without reinterpreting it as an instant. */+ bucket: string+ tool: string+ calls: integer+}++export interface MCPToolCallBreakdownQueryResponse extends AnalyticsQueryResponseBase {+ results: MCPToolCallBreakdownItem[]+}++/** Interval-bucketed call counts per tool, powering the dashboard's "Tool call breakdown" chart. */+export interface MCPToolCallBreakdownQuery extends DataNode<MCPToolCallBreakdownQueryResponse> {+ kind: NodeKind.MCPToolCallBreakdownQuery+ dateRange?: DateRange+ properties?: AnyPropertyFilter[]+ filterTestAccounts?: boolean+ /** Bucket granularity; the frontend passes getDefaultInterval. Defaults to day. */+ interval?: IntervalType+}++export type CachedMCPToolCallBreakdownQueryResponse = CachedQueryResponse<MCPToolCallBreakdownQueryResponse>+/** One interval bucket of MCP tool-call activity, split into successful and failed calls. */export interface MCPToolCallsAndErrorsItem {/** Bucket start as a project-timezone wall clock ("YYYY-MM-DD HH:mm:ss"), never zone-stamped, sodiff --git a/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx b/frontend/src/scenes/saved-insights/insightTypesMetadata.tsxindex 418221430a12..e7af8c6b58db 100644--- a/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx+++ b/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx@@ -549,6 +549,12 @@ export const QUERY_TYPES_METADATA: Record<NodeKind, InsightTypeMetadata> = {icon: IconPieChart,inMenu: false,},+ [NodeKind.MCPToolCallBreakdownQuery]: {+ name: 'MCP tool call breakdown',+ description: 'MCP tool-call volume over time, broken down by tool.',+ icon: IconPieChart,+ inMenu: false,+ },[NodeKind.MCPToolCallsAndErrorsQuery]: {name: 'MCP tool calls and errors',description: 'MCP tool-call volume over time, split into successful and failed calls.',diff --git a/posthog/api/query.py b/posthog/api/query.pyindex 2c27de161f29..45f007c0852e 100644--- a/posthog/api/query.py+++ b/posthog/api/query.py@@ -167,6 +167,7 @@ _QUERY_KIND_SCOPES: dict[str, list[str]] = {# rather than adding to it, and a token must hold every listed scope."MCPToolFailureOccurrencesQuery": ["query:read", "mcp_analytics:read"],"MCPToolCallsAndErrorsQuery": ["query:read", "mcp_analytics:read"],+ "MCPToolCallBreakdownQuery": ["query:read", "mcp_analytics:read"],}diff --git a/posthog/clickhouse/query_tagging.py b/posthog/clickhouse/query_tagging.pyindex ed8334279de6..be761bb6c9c7 100644--- a/posthog/clickhouse/query_tagging.py+++ b/posthog/clickhouse/query_tagging.py@@ -268,6 +268,7 @@ def kind_fallback_tags(kind: NodeKind) -> FallbackTags | None:return {"product": Product.MARKETING_ANALYTICS}case (NodeKind.MCP_HARNESS_BREAKDOWN_QUERY+ | NodeKind.MCP_TOOL_CALL_BREAKDOWN_QUERY| NodeKind.MCP_TOOL_CALLS_AND_ERRORS_QUERY| NodeKind.MCP_TOOL_TOP_USERS_QUERY| NodeKind.MCP_TOOL_FAILURES_QUERYdiff --git a/posthog/hogql_queries/query_runner.py b/posthog/hogql_queries/query_runner.pyindex 2e5fed811279..67a311ae0dc9 100644--- a/posthog/hogql_queries/query_runner.py+++ b/posthog/hogql_queries/query_runner.py@@ -45,6 +45,7 @@ from posthog.schema import (MarketingAnalyticsAggregatedQuery,MarketingAnalyticsTableQuery,MCPHarnessBreakdownQuery,+ MCPToolCallBreakdownQuery,MCPToolCallsAndErrorsQuery,MCPToolCategoriesQuery,MCPToolCategoryCountsQuery,@@ -366,6 +367,7 @@ RunnableQueryNode = Union[EndpointsUsageTrendsQuery,MetricsQuery,MCPHarnessBreakdownQuery,+ MCPToolCallBreakdownQuery,MCPToolCallsAndErrorsQuery,MCPToolTopUsersQuery,MCPToolFailuresQuery,@@ -944,6 +946,17 @@ def get_query_runner(modifiers=modifiers,user=user,)+ if kind == "MCPToolCallBreakdownQuery":+ from products.mcp_analytics.backend.facade.queries import MCPToolCallBreakdownQueryRunner++ return MCPToolCallBreakdownQueryRunner(+ query=cast(MCPToolCallBreakdownQuery | dict[str, Any], query),+ team=team,+ timings=timings,+ limit_context=limit_context,+ modifiers=modifiers,+ user=user,+ )if kind == "MCPToolCallsAndErrorsQuery":from products.mcp_analytics.backend.facade.queries import MCPToolCallsAndErrorsQueryRunnerdiff --git a/posthog/schema.py b/posthog/schema.pyindex 94472702b60c..5701ab39d452 100644--- a/posthog/schema.py+++ b/posthog/schema.py@@ -5317,6 +5317,22 @@ class MCPHarnessBreakdownItem(BaseModel):total_calls: int+class MCPToolCallBreakdownItem(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ bucket: str = Field(+ ...,+ description=(+ 'Bucket start as a project-timezone wall clock ("YYYY-MM-DD HH:mm:ss"),'+ " never zone-stamped, so the client can join it against generated axis keys"+ " without reinterpreting it as an instant."+ ),+ )+ calls: int+ tool: str++class MCPToolCallsAndErrorsItem(BaseModel):model_config = ConfigDict(extra="forbid",@@ -10923,6 +10939,64 @@ class CachedMCPHarnessBreakdownQueryResponse(BaseModel):)+class CachedMCPToolCallBreakdownQueryResponse(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ cache_key: str+ cache_target_age: AwareDatetime | None = None+ calculation_trigger: str | None = Field(+ default=None,+ description=("What triggered the calculation of the query, leave empty if user/immediate"),+ )+ error: str | None = Field(+ default=None,+ description=(+ "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."+ ),+ )+ hogql: str | None = Field(default=None, description="Generated HogQL query.")+ is_cached: bool+ last_refresh: AwareDatetime+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")+ next_allowed_client_refresh: AwareDatetime+ query_metadata: dict[str, Any] | None = None+ query_status: QueryStatus | None = Field(+ default=None,+ description=("Query status indicates whether next to the provided data, a query is still running."),+ )+ resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(+ default=None,+ description=("The resolved previous/comparison period date range, when comparing against another period"),+ )+ resolved_date_range: ResolvedDateRangeResponse | None = Field(+ default=None, description="The date range used for the query"+ )+ results: list[MCPToolCallBreakdownItem]+ timezone: str+ timings: list[QueryTiming] | None = Field(+ default=None,+ description=("Measured timings for different parts of the query generation process"),+ )+ used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(+ default=None,+ description=("Connector-synced data warehouse sources referenced by this query, if any."),+ )+ warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(+ default=None,+ description=(+ "Warnings about data warehouse sources referenced by the query whose"+ " latest sync failed, is paused, hit a billing limit, or is otherwise"+ " stale. Results may not reflect current source data. Accumulated"+ " across every HogQL execution that contributes to this response — so"+ " insights backed by warehouse tables (Trends, Funnels, etc.) receive"+ " the same warnings as raw HogQL queries. Also carries access control"+ " warnings when a system-table query filters out objects the user can't"+ " access."+ ),+ )++class CachedMCPToolCallsAndErrorsQueryResponse(BaseModel):model_config = ConfigDict(extra="forbid",@@ -16691,6 +16765,53 @@ class MCPHarnessBreakdownQueryResponse(BaseModel):)+class MCPToolCallBreakdownQueryResponse(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ error: str | None = Field(+ default=None,+ description=(+ "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."+ ),+ )+ hogql: str | None = Field(default=None, description="Generated HogQL query.")+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")+ query_status: QueryStatus | None = Field(+ default=None,+ description=("Query status indicates whether next to the provided data, a query is still running."),+ )+ resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(+ default=None,+ description=("The resolved previous/comparison period date range, when comparing against another period"),+ )+ resolved_date_range: ResolvedDateRangeResponse | None = Field(+ default=None, description="The date range used for the query"+ )+ results: list[MCPToolCallBreakdownItem]+ timings: list[QueryTiming] | None = Field(+ default=None,+ description=("Measured timings for different parts of the query generation process"),+ )+ used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(+ default=None,+ description=("Connector-synced data warehouse sources referenced by this query, if any."),+ )+ warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(+ default=None,+ description=(+ "Warnings about data warehouse sources referenced by the query whose"+ " latest sync failed, is paused, hit a billing limit, or is otherwise"+ " stale. Results may not reflect current source data. Accumulated"+ " across every HogQL execution that contributes to this response — so"+ " insights backed by warehouse tables (Trends, Funnels, etc.) receive"+ " the same warnings as raw HogQL queries. Also carries access control"+ " warnings when a system-table query filters out objects the user can't"+ " access."+ ),+ )++class MCPToolCallsAndErrorsQueryResponse(BaseModel):model_config = ConfigDict(extra="forbid",@@ -21195,7 +21316,7 @@ class QueryResponseAlternative87(BaseModel):resolved_date_range: ResolvedDateRangeResponse | None = Field(default=None, description="The date range used for the query")- results: list[MCPToolCallsAndErrorsItem]+ results: list[MCPToolCallBreakdownItem]timings: list[QueryTiming] | None = Field(default=None,description=("Measured timings for different parts of the query generation process"),@@ -21242,7 +21363,7 @@ class QueryResponseAlternative88(BaseModel):resolved_date_range: ResolvedDateRangeResponse | None = Field(default=None, description="The date range used for the query")- results: list[MCPHarnessBreakdownItem]+ results: list[MCPToolCallsAndErrorsItem]timings: list[QueryTiming] | None = Field(default=None,description=("Measured timings for different parts of the query generation process"),@@ -21289,7 +21410,7 @@ class QueryResponseAlternative89(BaseModel):resolved_date_range: ResolvedDateRangeResponse | None = Field(default=None, description="The date range used for the query")- results: list[MCPToolTopUserItem]+ results: list[MCPHarnessBreakdownItem]timings: list[QueryTiming] | None = Field(default=None,description=("Measured timings for different parts of the query generation process"),@@ -21336,7 +21457,7 @@ class QueryResponseAlternative90(BaseModel):resolved_date_range: ResolvedDateRangeResponse | None = Field(default=None, description="The date range used for the query")- results: list[MCPToolFailureItem]+ results: list[MCPToolTopUserItem]timings: list[QueryTiming] | None = Field(default=None,description=("Measured timings for different parts of the query generation process"),@@ -21383,7 +21504,7 @@ class QueryResponseAlternative91(BaseModel):resolved_date_range: ResolvedDateRangeResponse | None = Field(default=None, description="The date range used for the query")- results: list[MCPToolFailureOccurrenceItem]+ results: list[MCPToolFailureItem]timings: list[QueryTiming] | None = Field(default=None,description=("Measured timings for different parts of the query generation process"),@@ -21408,6 +21529,53 @@ class QueryResponseAlternative91(BaseModel):class QueryResponseAlternative92(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ error: str | None = Field(+ default=None,+ description=(+ "Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise."+ ),+ )+ hogql: str | None = Field(default=None, description="Generated HogQL query.")+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")+ query_status: QueryStatus | None = Field(+ default=None,+ description=("Query status indicates whether next to the provided data, a query is still running."),+ )+ resolved_compare_date_range: ResolvedDateRangeResponse | None = Field(+ default=None,+ description=("The resolved previous/comparison period date range, when comparing against another period"),+ )+ resolved_date_range: ResolvedDateRangeResponse | None = Field(+ default=None, description="The date range used for the query"+ )+ results: list[MCPToolFailureOccurrenceItem]+ timings: list[QueryTiming] | None = Field(+ default=None,+ description=("Measured timings for different parts of the query generation process"),+ )+ used_data_warehouse_sources: list[DataWarehouseSourceUsage] | None = Field(+ default=None,+ description=("Connector-synced data warehouse sources referenced by this query, if any."),+ )+ warnings: list[DataWarehouseSyncWarning | AccessControlFilterWarning] | None = Field(+ default=None,+ description=(+ "Warnings about data warehouse sources referenced by the query whose"+ " latest sync failed, is paused, hit a billing limit, or is otherwise"+ " stale. Results may not reflect current source data. Accumulated"+ " across every HogQL execution that contributes to this response — so"+ " insights backed by warehouse tables (Trends, Funnels, etc.) receive"+ " the same warnings as raw HogQL queries. Also carries access control"+ " warnings when a system-table query filters out objects the user can't"+ " access."+ ),+ )+++class QueryResponseAlternative93(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -21457,7 +21625,7 @@ class QueryResponseAlternative92(BaseModel):)-class QueryResponseAlternative93(BaseModel):+class QueryResponseAlternative94(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -21504,7 +21672,7 @@ class QueryResponseAlternative93(BaseModel):)-class QueryResponseAlternative94(BaseModel):+class QueryResponseAlternative95(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -21551,7 +21719,7 @@ class QueryResponseAlternative94(BaseModel):)-class QueryResponseAlternative95(BaseModel):+class QueryResponseAlternative96(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -21598,7 +21766,7 @@ class QueryResponseAlternative95(BaseModel):)-class QueryResponseAlternative96(BaseModel):+class QueryResponseAlternative97(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -21645,7 +21813,7 @@ class QueryResponseAlternative96(BaseModel):)-class QueryResponseAlternative97(BaseModel):+class QueryResponseAlternative98(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -21692,7 +21860,7 @@ class QueryResponseAlternative97(BaseModel):)-class QueryResponseAlternative98(BaseModel):+class QueryResponseAlternative99(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -21739,7 +21907,7 @@ class QueryResponseAlternative98(BaseModel):)-class QueryResponseAlternative99(BaseModel):+class QueryResponseAlternative100(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -21786,7 +21954,7 @@ class QueryResponseAlternative99(BaseModel):)-class QueryResponseAlternative100(BaseModel):+class QueryResponseAlternative101(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -21833,7 +22001,7 @@ class QueryResponseAlternative100(BaseModel):)-class QueryResponseAlternative101(BaseModel):+class QueryResponseAlternative102(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -24023,6 +24191,24 @@ class MCPHarnessBreakdownQuery(BaseModel):version: float | None = Field(default=None, description="version of the node, used for schema migrations")+class MCPToolCallBreakdownQuery(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ dateRange: DateRange | None = None+ filterTestAccounts: bool | None = None+ interval: IntervalType | None = Field(+ default=None,+ description=("Bucket granularity; the frontend passes getDefaultInterval. Defaults to day."),+ )+ kind: Literal["MCPToolCallBreakdownQuery"] = "MCPToolCallBreakdownQuery"+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")+ properties: list[AnyPropertyFilterDiscriminated] | None = None+ response: MCPToolCallBreakdownQueryResponse | None = None+ tags: QueryLogTags | None = None+ version: float | None = Field(default=None, description="version of the node, used for schema migrations")++class MCPToolCallsAndErrorsQuery(BaseModel):model_config = ConfigDict(extra="forbid",@@ -26529,6 +26715,7 @@ class QueryResponseAlternative(| QueryResponseAlternative99| QueryResponseAlternative100| QueryResponseAlternative101+ | QueryResponseAlternative102]):root: (@@ -26630,6 +26817,7 @@ class QueryResponseAlternative(| QueryResponseAlternative99| QueryResponseAlternative100| QueryResponseAlternative101+ | QueryResponseAlternative102)@@ -27574,6 +27762,7 @@ class HogQLAutocomplete(BaseModel):| EndpointsUsageOverviewQuery| EndpointsUsageTableQuery| EndpointsUsageTrendsQuery+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery@@ -27677,6 +27866,7 @@ class HogQLMetadata(BaseModel):| EndpointsUsageOverviewQuery| EndpointsUsageTableQuery| EndpointsUsageTrendsQuery+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery@@ -27812,6 +28002,7 @@ class MaxInsightContext(BaseModel):| EndpointsUsageOverviewQuery| EndpointsUsageTableQuery| EndpointsUsageTrendsQuery+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery@@ -27943,6 +28134,7 @@ class QueryRequest(BaseModel):| EndpointsUsageOverviewQuery| EndpointsUsageTableQuery| EndpointsUsageTrendsQuery+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery@@ -28066,6 +28258,7 @@ class QuerySchemaRoot(| EndpointsUsageOverviewQuery| EndpointsUsageTableQuery| EndpointsUsageTrendsQuery+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery@@ -28159,6 +28352,7 @@ class QuerySchemaRoot(| EndpointsUsageOverviewQuery| EndpointsUsageTableQuery| EndpointsUsageTrendsQuery+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery@@ -28257,6 +28451,7 @@ class QueryUpgradeRequest(BaseModel):| EndpointsUsageOverviewQuery| EndpointsUsageTableQuery| EndpointsUsageTrendsQuery+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery@@ -28355,6 +28550,7 @@ class QueryUpgradeResponse(BaseModel):| EndpointsUsageOverviewQuery| EndpointsUsageTableQuery| EndpointsUsageTrendsQuery+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery@@ -28635,6 +28831,7 @@ class VisualizationArtifactContent(BaseModel):| EndpointsUsageOverviewQuery| EndpointsUsageTableQuery| EndpointsUsageTrendsQuery+ | MCPToolCallBreakdownQuery| MCPToolCallsAndErrorsQuery| MCPHarnessBreakdownQuery| MCPToolTopUsersQuerydiff --git a/posthog/schema_enums.py b/posthog/schema_enums.pyindex 8548eafaf8b0..72fca7844677 100644--- a/posthog/schema_enums.py+++ b/posthog/schema_enums.py@@ -3233,6 +3233,7 @@ class NodeKind(StrEnum):ENDPOINTS_USAGE_OVERVIEW_QUERY = "EndpointsUsageOverviewQuery"ENDPOINTS_USAGE_TABLE_QUERY = "EndpointsUsageTableQuery"ENDPOINTS_USAGE_TRENDS_QUERY = "EndpointsUsageTrendsQuery"+ MCP_TOOL_CALL_BREAKDOWN_QUERY = "MCPToolCallBreakdownQuery"MCP_TOOL_CALLS_AND_ERRORS_QUERY = "MCPToolCallsAndErrorsQuery"MCP_HARNESS_BREAKDOWN_QUERY = "MCPHarnessBreakdownQuery"MCP_TOOL_TOP_USERS_QUERY = "MCPToolTopUsersQuery"diff --git a/products/mcp_analytics/backend/facade/queries.py b/products/mcp_analytics/backend/facade/queries.pyindex 756861f2af5a..7c0587f0ce2f 100644--- a/products/mcp_analytics/backend/facade/queries.py+++ b/products/mcp_analytics/backend/facade/queries.py@@ -5,7 +5,10 @@ mcp_analytics is tach-isolated to expose only `backend.facade.*`, so core's`backend.hogql_queries` directly."""-from products.mcp_analytics.backend.hogql_queries.dashboard_series import MCPToolCallsAndErrorsQueryRunner+from products.mcp_analytics.backend.hogql_queries.dashboard_series import (+ MCPToolCallBreakdownQueryRunner,+ MCPToolCallsAndErrorsQueryRunner,+)from products.mcp_analytics.backend.hogql_queries.harness_breakdown import MCPHarnessBreakdownQueryRunnerfrom products.mcp_analytics.backend.hogql_queries.tool_quality_tables import (MCPToolCategoriesQueryRunner,@@ -26,6 +29,7 @@ from products.mcp_analytics.backend.hogql_queries.tool_tables import (__all__ = ["MCPHarnessBreakdownQueryRunner",+ "MCPToolCallBreakdownQueryRunner","MCPToolCallsAndErrorsQueryRunner","MCPToolCategoriesQueryRunner","MCPToolCategoryCountsQueryRunner",diff --git a/products/mcp_analytics/backend/hogql_queries/dashboard_series.py b/products/mcp_analytics/backend/hogql_queries/dashboard_series.pyindex 995a16fe5562..3cf35d7d460c 100644--- a/products/mcp_analytics/backend/hogql_queries/dashboard_series.py+++ b/products/mcp_analytics/backend/hogql_queries/dashboard_series.py@@ -5,7 +5,11 @@ from typing import TYPE_CHECKINGfrom posthog.schema import (AnyPropertyFilterDiscriminated,+ CachedMCPToolCallBreakdownQueryResponse,CachedMCPToolCallsAndErrorsQueryResponse,+ MCPToolCallBreakdownItem,+ MCPToolCallBreakdownQuery,+ MCPToolCallBreakdownQueryResponse,MCPToolCallsAndErrorsItem,MCPToolCallsAndErrorsQuery,MCPToolCallsAndErrorsQueryResponse,@@ -124,3 +128,80 @@ class MCPToolCallsAndErrorsQueryRunner(AnalyticsQueryRunner[MCPToolCallsAndErrorreturn MCPToolCallsAndErrorsQueryResponse(results=results, timings=response.timings, hogql=response.hogql, modifiers=self.modifiers)+++class MCPToolCallBreakdownQueryRunner(AnalyticsQueryRunner[MCPToolCallBreakdownQueryResponse]):+ """Interval-bucketed call counts per tool behind the dashboard's "Tool call breakdown" chart."""++ query: MCPToolCallBreakdownQuery+ cached_response: CachedMCPToolCallBreakdownQueryResponse++ def validate_query_runner_access(self, user: "User") -> bool:+ return validate_mcp_analytics_access(self.team, user)++ @cached_property+ def query_date_range(self) -> QueryDateRange:+ return mcp_query_date_range(self.team, self.query.dateRange, self.query.interval)++ def to_query(self) -> ast.SelectQuery | ast.SelectSetQuery:+ # See MCPToolCallsAndErrorsQueryRunner.to_query for why the bucket is stringified here.+ #+ # These rows fan out over buckets × distinct tools, so the cap has to clear that product+ # rather than the sibling runner's bucket count. Truncating costs more than a short axis+ # here: the client sums each tool across buckets to rank the top ones and roll the rest into+ # "Other", so dropped rows silently undercount totals and reorder the legend. The dashboard+ # keeps bucket counts near 90 on its own, but this kind is also reachable through /query/,+ # where an hourly interval over a month is 720 buckets and only needs 14 tools to overrun a+ # 10k cap.+ interval = self.query.interval.value if self.query.interval else "day"+ return parse_select(+ """+ SELECT+ toString(dateTrunc({interval}, timestamp)) AS bucket,+ toString(properties.$mcp_tool_name) AS tool,+ count() AS calls+ FROM events+ WHERE {where}+ GROUP BY bucket, tool+ ORDER BY bucket+ LIMIT 100000+ """,+ placeholders={+ "interval": ast.Constant(value=interval),+ "where": _dashboard_where(+ self.query_date_range,+ self.query.properties,+ self.query.filterTestAccounts,+ self.team,+ ),+ },+ )++ def _calculate(self) -> MCPToolCallBreakdownQueryResponse:+ with tags_context(+ product=Product.MCP_ANALYTICS,+ feature=Feature.QUERY,+ team_id=self.team.id,+ name="mcp_tool_call_breakdown_query",+ ):+ response = execute_hogql_query(+ query=self.to_query(),+ team=self.team,+ user=self.user,+ query_type="mcp_tool_call_breakdown_query",+ timings=self.timings,+ modifiers=self.modifiers,+ limit_context=self.limit_context,+ )++ results = [+ MCPToolCallBreakdownItem(+ bucket=str(row[0] or ""),+ tool=str(row[1] or ""),+ calls=int(row[2] or 0),+ )+ for row in (response.results or [])+ ]+ return MCPToolCallBreakdownQueryResponse(+ results=results, timings=response.timings, hogql=response.hogql, modifiers=self.modifiers+ )diff --git a/products/mcp_analytics/backend/tests/test_dashboard_series.py b/products/mcp_analytics/backend/tests/test_dashboard_series.pyindex 950bfec65858..ad8709c95c6a 100644--- a/products/mcp_analytics/backend/tests/test_dashboard_series.py+++ b/products/mcp_analytics/backend/tests/test_dashboard_series.py@@ -11,6 +11,8 @@ from posthog.schema import (DateRange,EventPropertyFilter,IntervalType,+ MCPToolCallBreakdownItem,+ MCPToolCallBreakdownQuery,MCPToolCallsAndErrorsItem,MCPToolCallsAndErrorsQuery,PropertyOperator,@@ -20,7 +22,10 @@ from posthog.models.personal_api_key import PersonalAPIKeyfrom posthog.models.utils import generate_random_token_personal, hash_key_valuefrom posthog.rbac.user_access_control import UserAccessControlError-from products.mcp_analytics.backend.hogql_queries.dashboard_series import MCPToolCallsAndErrorsQueryRunner+from products.mcp_analytics.backend.hogql_queries.dashboard_series import (+ MCPToolCallBreakdownQueryRunner,+ MCPToolCallsAndErrorsQueryRunner,+)from products.mcp_analytics.backend.tests import _MCPAnalyticsTeamScopedTestMixin@@ -148,33 +153,79 @@ class TestMCPToolCallsAndErrorsQueryRunner(_MCPAnalyticsTeamScopedTestMixin, Cliassert [r.successes for r in unfiltered] == [2]assert [r.successes for r in filtered] == [1]- @parameterized.expand(- [- (["query:read"], 403),- (["mcp_analytics:read"], 403),- (["query:read", "mcp_analytics:read"], 200),+ def test_excludes_calls_without_a_tool_name(self) -> None:+ self._emit(timestamp=datetime(2026, 7, 21, 18, 0, tzinfo=UTC))+ self._emit(timestamp=datetime(2026, 7, 21, 18, 0, tzinfo=UTC), tool_name="")++ results = self._run(+ MCPToolCallsAndErrorsQuery(dateRange=DateRange(date_from="2026-07-19", date_to="2026-07-23"))+ )++ assert [(r.bucket, r.successes) for r in results] == [("2026-07-21 00:00:00", 1)]+++class TestMCPToolCallBreakdownQueryRunner(_MCPAnalyticsTeamScopedTestMixin, ClickhouseTestMixin, APIBaseTest):+ def setUp(self) -> None:+ super().setUp()+ self.team.timezone = "US/Pacific"+ self.team.save()++ def _emit(self, *, timestamp: datetime, tool_name: str) -> None:+ _create_event(+ team=self.team,+ event="$mcp_tool_call",+ distinct_id="d1",+ timestamp=timestamp,+ properties={"$session_id": "s1", "$mcp_tool_name": tool_name, "$mcp_is_error": False},+ )++ def _run(self, query: MCPToolCallBreakdownQuery) -> list[MCPToolCallBreakdownItem]:+ flush_persons_and_events()+ return MCPToolCallBreakdownQueryRunner(query=query, team=self.team).calculate().results++ def test_splits_calls_by_tool_within_each_bucket(self) -> None:+ self._emit(timestamp=datetime(2026, 7, 21, 2, 0, tzinfo=UTC), tool_name="query_run")+ self._emit(timestamp=datetime(2026, 7, 21, 18, 0, tzinfo=UTC), tool_name="query_run")+ self._emit(timestamp=datetime(2026, 7, 21, 19, 0, tzinfo=UTC), tool_name="dashboard_create")++ results = self._run(+ MCPToolCallBreakdownQuery(dateRange=DateRange(date_from="2026-07-19", date_to="2026-07-23"))+ )++ assert sorted((r.bucket, r.tool, r.calls) for r in results) == [+ ("2026-07-20 00:00:00", "query_run", 1),+ ("2026-07-21 00:00:00", "dashboard_create", 1),+ ("2026-07-21 00:00:00", "query_run", 1),]- )- def test_query_endpoint_scope_parity_for_api_keys(self, scopes: list[str], expected_status: int) -> None:- # The runner's access check reads the token owner's RBAC, not the token's granted scopes, so- # without an entry in _QUERY_KIND_SCOPES the generic /query/ endpoint would serve this kind- # to any token holding only query:read.- value = generate_random_token_personal()- PersonalAPIKey.objects.create(label="test", user=self.user, secure_value=hash_key_value(value), scopes=scopes)- response = self.client.post(- f"/api/projects/{self.team.pk}/query/",- {"query": {"kind": "MCPToolCallsAndErrorsQuery"}},- HTTP_AUTHORIZATION=f"Bearer {value}",+ def test_property_filters_scope_the_series(self) -> None:+ self._emit(timestamp=datetime(2026, 7, 21, 18, 0, tzinfo=UTC), tool_name="query_run")+ self._emit(timestamp=datetime(2026, 7, 21, 18, 0, tzinfo=UTC), tool_name="other_tool")++ results = self._run(+ MCPToolCallBreakdownQuery(+ dateRange=DateRange(date_from="2026-07-19", date_to="2026-07-23"),+ properties=[+ EventPropertyFilter(key="$mcp_tool_name", value=["query_run"], operator=PropertyOperator.EXACT)+ ],+ ))- assert response.status_code == expected_status, response.json()+ assert [(r.tool, r.calls) for r in results] == [("query_run", 1)]- def test_gates_on_the_mcp_analytics_flag(self) -> None:- # Every other test calls calculate() with the flag already on, so a runner that lost its- # validate_query_runner_access override would stay green while the generic /query/ endpoint- # reached it ungated (the base implementation returns True).- runner = MCPToolCallsAndErrorsQueryRunner(query=MCPToolCallsAndErrorsQuery(), team=self.team, user=self.user)++class TestMCPDashboardSeriesGate(_MCPAnalyticsTeamScopedTestMixin, ClickhouseTestMixin, APIBaseTest):+ # Every other test here calls calculate() with the flag already on, so a runner that lost its+ # validate_query_runner_access override would stay green while the generic /query/ endpoint+ # reached it ungated (the base implementation returns True).+ @parameterized.expand(+ [+ (MCPToolCallsAndErrorsQueryRunner, MCPToolCallsAndErrorsQuery()),+ (MCPToolCallBreakdownQueryRunner, MCPToolCallBreakdownQuery()),+ ]+ )+ def test_runner_gates_on_mcp_analytics_flag(self, runner_cls: Any, query: Any) -> None:+ runner = runner_cls(query=query, team=self.team, user=self.user)assert runner.validate_query_runner_access(self.user) is True@@ -182,12 +233,28 @@ class TestMCPToolCallsAndErrorsQueryRunner(_MCPAnalyticsTeamScopedTestMixin, Cliwith self.assertRaises(UserAccessControlError):runner.validate_query_runner_access(self.user)- def test_excludes_calls_without_a_tool_name(self) -> None:- self._emit(timestamp=datetime(2026, 7, 21, 18, 0, tzinfo=UTC))- self._emit(timestamp=datetime(2026, 7, 21, 18, 0, tzinfo=UTC), tool_name="")+ # The runners' access check reads the token owner's RBAC, not the token's granted scopes, so a+ # kind registered on the generic query endpoint without a _QUERY_KIND_SCOPES entry is reachable+ # by any token holding only query:read.+ @parameterized.expand(+ [+ (kind, scopes, expected_status)+ for kind in ("MCPToolCallsAndErrorsQuery", "MCPToolCallBreakdownQuery")+ for scopes, expected_status in (+ (["query:read"], 403),+ (["mcp_analytics:read"], 403),+ (["query:read", "mcp_analytics:read"], 200),+ )+ ]+ )+ def test_query_endpoint_scope_parity_for_api_keys(self, kind: str, scopes: list[str], expected_status: int) -> None:+ value = generate_random_token_personal()+ PersonalAPIKey.objects.create(label="test", user=self.user, secure_value=hash_key_value(value), scopes=scopes)- results = self._run(- MCPToolCallsAndErrorsQuery(dateRange=DateRange(date_from="2026-07-19", date_to="2026-07-23"))+ response = self.client.post(+ f"/api/projects/{self.team.pk}/query/",+ {"query": {"kind": kind}},+ HTTP_AUTHORIZATION=f"Bearer {value}",)- assert [(r.bucket, r.successes) for r in results] == [("2026-07-21 00:00:00", 1)]+ assert response.status_code == expected_status, response.json()diff --git a/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx b/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsxindex 2ac05ddc600f..411cb2ce866c 100644--- a/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx+++ b/products/mcp_analytics/frontend/MCPAnalyticsDashboard.stories.tsx@@ -518,6 +518,18 @@ const meta: Meta = {},]}+ if (body?.query?.kind === 'MCPToolCallBreakdownQuery') {+ return [+ 200,+ {+ results: TOOL_DAILY_RESULTS.map(([bucket, tool, calls]) => ({+ bucket,+ tool,+ calls,+ })),+ },+ ]+ }if (body?.query?.kind === 'MCPToolCallsAndErrorsQuery') {return [200,@@ -544,9 +556,6 @@ const meta: Meta = {if (query.includes('AS session_id')) {return [200, { results: SESSION_RESULTS }]}- if (query.includes('GROUP BY day, tool')) {- return [200, { results: TOOL_DAILY_RESULTS }]- }if (query.includes('p95_duration_ms')) {return [200, { results: TOOL_RESULTS }]}diff --git a/products/mcp_analytics/frontend/dashboard/ToolUsageChart.tsx b/products/mcp_analytics/frontend/dashboard/ToolUsageChart.tsxindex d4e7df00cc3d..b80d22e19002 100644--- a/products/mcp_analytics/frontend/dashboard/ToolUsageChart.tsx+++ b/products/mcp_analytics/frontend/dashboard/ToolUsageChart.tsx@@ -55,7 +55,10 @@ export function ToolUsageChart({<Card title="Tool call breakdown"><CardStateloading={loading}- isEmpty={data.tools.length === 0}+ // Rows whose buckets fall outside the client's keys still contribute their tool+ // names, so `tools` can be non-empty with every series zeroed. Checking the counts+ // rather than the names keeps that rendering as the empty state, not a blank stack.+ isEmpty={data.tools.every((t) => t.data.every((v) => v === 0))}skeleton={<Skeleton className="h-[260px] w-full" />}empty={<div className="py-6 text-center text-[12px] text-secondary">No tool calls yet.</div>}>diff --git a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.test.ts b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.test.tsindex 0b8a78206b30..26cd710b7859 100644--- a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.test.ts+++ b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.test.ts@@ -465,7 +465,7 @@ describe('mcpDashboardOverviewLogic', () => {const bucketed = mockApi.query.mock.calls.map((call) => (call[0] as any).query).filter((query: string | undefined): query is string => !!query?.includes('dateTrunc('))- expect(bucketed).toHaveLength(2)+ expect(bucketed).toHaveLength(1)expect(bucketed.filter((query) => !query.includes('toString(dateTrunc('))).toEqual([])})diff --git a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.tsindex 2c2eda07dd67..c88fd90b8432 100644--- a/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts+++ b/products/mcp_analytics/frontend/mcpDashboardOverviewLogic.ts@@ -13,6 +13,7 @@ import {HogQLFilters,HogQLQueryResponse,MCPHarnessBreakdownItem,+ MCPToolCallBreakdownItem,MCPToolCallsAndErrorsItem,NodeKind,} from '~/queries/schema/schema-general'@@ -116,29 +117,12 @@ LIMIT 50// single source of truth for client → harness labelling — so the tile reads typed,// already-bucketed rows rather than re-deriving the labels in the browser.-// Daily call counts per tool, powering the tool-usage stacked bar (one segment per tool).-const TOOL_DAILY_QUERY = `-SELECT- __BUCKET__ AS day,- toString(properties.$mcp_tool_name) AS tool,- count() AS calls-FROM events-WHERE event = '$mcp_tool_call'- AND properties.$mcp_tool_name IS NOT NULL- AND properties.$mcp_tool_name != ''- AND {filters}-GROUP BY day, tool-ORDER BY day-LIMIT 10000-`--// The `__BUCKET__` expression the remaining inline bucketed queries are built with. toString() is-// load-bearing:-// a bare dateTrunc returns a typed DateTime that the query API serializes with the project's UTC-// offset attached (2026-07-21T00:00:00-07:00), which the client then reads back as an instant and+// The `__BUCKET__` expression the KPI query is built with. toString() is load-bearing: a bare+// dateTrunc returns a typed DateTime that the query API serializes with the project's UTC offset+// attached (2026-07-21T00:00:00-07:00), which the client then reads back as an instant and// converts, shifting every bucket away from the wall-clock keys it joins and compares against.// Rendering it server-side leaves a plain string with nothing left to reinterpret, matching the-// backend runners (tool_quality_tables.py, tool_tables.py).+// backend runners (dashboard_series.py, tool_quality_tables.py, tool_tables.py).const bucketExpr = (interval: IntervalType): string => `toString(dateTrunc('${interval}', timestamp))`export interface BucketRow {@@ -831,17 +815,19 @@ export const mcpDashboardOverviewLogic = kea<mcpDashboardOverviewLogicType>([[] as ToolDailyRow[],{loadToolDailyRows: async (_: void, breakpoint): Promise<ToolDailyRow[]> => {+ const { dateRange, properties, filterTestAccounts } = values.queryFiltersconst response = (await api.query({- kind: NodeKind.HogQLQuery,- query: TOOL_DAILY_QUERY.replace('__BUCKET__', bucketExpr(values.interval)),- filters: values.queryFilters,- })) as HogQLQueryResponse+ kind: NodeKind.MCPToolCallBreakdownQuery,+ dateRange,+ properties,+ filterTestAccounts,+ interval: values.interval,+ })) as { results?: MCPToolCallBreakdownItem[] }breakpoint()- const raw = (response?.results as unknown[][]) ?? []- return raw.map((r) => ({- day: normalizeBucket(r[0]),- tool: String(r[1] ?? ''),- calls: Number(r[2] ?? 0),+ return (response?.results ?? []).map((r) => ({+ day: normalizeBucket(r.bucket),+ tool: r.tool,+ calls: r.calls,}))},},diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 702eec10246d..c9bc39cae4bd 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -35805,6 +35805,50 @@ export namespace Schemas {version?: number | null;}+ export interface MCPToolCallBreakdownItem {+ /** Bucket start as a project-timezone wall clock ("YYYY-MM-DD HH:mm:ss"), never zone-stamped, so the client can join it against generated axis keys without reinterpreting it as an instant. */+ bucket: string;+ calls: number;+ tool: string;+ }++ export interface MCPToolCallBreakdownQueryResponse {+ /** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */+ error?: string | null;+ /** Generated HogQL query. */+ hogql?: string | null;+ /** Modifiers used when performing the query */+ modifiers?: HogQLQueryModifiers | null;+ /** Query status indicates whether next to the provided data, a query is still running. */+ query_status?: QueryStatus | null;+ /** The resolved previous/comparison period date range, when comparing against another period */+ resolved_compare_date_range?: ResolvedDateRangeResponse | null;+ /** The date range used for the query */+ resolved_date_range?: ResolvedDateRangeResponse | null;+ results: MCPToolCallBreakdownItem[];+ /** Measured timings for different parts of the query generation process */+ timings?: QueryTiming[] | null;+ /** Connector-synced data warehouse sources referenced by this query, if any. */+ used_data_warehouse_sources?: DataWarehouseSourceUsage[] | null;+ /** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access. */+ warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;+ }++ export interface MCPToolCallBreakdownQuery {+ dateRange?: DateRange | null;+ filterTestAccounts?: boolean | null;+ /** Bucket granularity; the frontend passes getDefaultInterval. Defaults to day. */+ interval?: IntervalType | null;+ kind?: 'MCPToolCallBreakdownQuery';+ /** Modifiers used when performing the query */+ modifiers?: HogQLQueryModifiers | null;+ properties?: (EventPropertyFilter | PersonPropertyFilter | PersonMetadataPropertyFilter | ElementPropertyFilter | EventMetadataPropertyFilter | SessionPropertyFilter | CohortPropertyFilter | RecordingPropertyFilter | LogEntryPropertyFilter | GroupPropertyFilter | FeaturePropertyFilter | FlagPropertyFilter | HogQLPropertyFilter | EmptyPropertyFilter | DataWarehousePropertyFilter | DataWarehousePersonPropertyFilter | ErrorTrackingIssueFilter | LogPropertyFilter | MetricPropertyFilter | SpanPropertyFilter | RevenueAnalyticsPropertyFilter | AccountCustomPropertyFilter | WorkflowVariablePropertyFilter)[] | null;+ response?: MCPToolCallBreakdownQueryResponse | null;+ tags?: QueryLogTags | null;+ /** version of the node, used for schema migrations */+ version?: number | null;+ }+export interface MCPToolCallsAndErrorsItem {/** Bucket start as a project-timezone wall clock ("YYYY-MM-DD HH:mm:ss"), never zone-stamped, so the client can join it against generated axis keys without reinterpreting it as an instant. */bucket: string;@@ -36472,7 +36516,7 @@ export namespace Schemas {query: string;response?: HogQLMetadataResponse | null;/** Query within which "expr" and "template" are validated. Defaults to "select * from events" */- sourceQuery?: EventsNode | ActionsNode | PersonsNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | null;+ sourceQuery?: EventsNode | ActionsNode | PersonsNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | null;tags?: QueryLogTags | null;/** Variables to be subsituted into the query */variables?: HogQLMetadataVariables;@@ -36498,7 +36542,7 @@ export namespace Schemas {query: string;response?: HogQLAutocompleteResponse | null;/** Query in whose context to validate. */- sourceQuery?: EventsNode | ActionsNode | PersonsNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | null;+ sourceQuery?: EventsNode | ActionsNode | PersonsNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | null;/** Start position of the editor word */startPosition: number;tags?: QueryLogTags | null;@@ -58329,7 +58373,7 @@ export namespace Schemas {* ```** For more details on HogQL queries, see the [PostHog HogQL documentation](/docs/hogql#api-access). */- query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | PropertyValuesQuery;+ query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | PropertyValuesQuery;/** Whether results should be calculated sync or async, and how much to rely on the cache:* - `'blocking'` - calculate synchronously (returning only when the query is done), UNLESS there are very fresh results in the cache* - `'async'` - kick off background calculation (returning immediately with a query status), UNLESS there are very fresh results in the cache@@ -60323,7 +60367,7 @@ export namespace Schemas {resolved_compare_date_range?: ResolvedDateRangeResponse | null;/** The date range used for the query */resolved_date_range?: ResolvedDateRangeResponse | null;- results: MCPToolCallsAndErrorsItem[];+ results: MCPToolCallBreakdownItem[];/** Measured timings for different parts of the query generation process */timings?: QueryTiming[] | null;/** Connector-synced data warehouse sources referenced by this query, if any. */@@ -60345,7 +60389,7 @@ export namespace Schemas {resolved_compare_date_range?: ResolvedDateRangeResponse | null;/** The date range used for the query */resolved_date_range?: ResolvedDateRangeResponse | null;- results: MCPHarnessBreakdownItem[];+ results: MCPToolCallsAndErrorsItem[];/** Measured timings for different parts of the query generation process */timings?: QueryTiming[] | null;/** Connector-synced data warehouse sources referenced by this query, if any. */@@ -60367,7 +60411,7 @@ export namespace Schemas {resolved_compare_date_range?: ResolvedDateRangeResponse | null;/** The date range used for the query */resolved_date_range?: ResolvedDateRangeResponse | null;- results: MCPToolTopUserItem[];+ results: MCPHarnessBreakdownItem[];/** Measured timings for different parts of the query generation process */timings?: QueryTiming[] | null;/** Connector-synced data warehouse sources referenced by this query, if any. */@@ -60389,7 +60433,7 @@ export namespace Schemas {resolved_compare_date_range?: ResolvedDateRangeResponse | null;/** The date range used for the query */resolved_date_range?: ResolvedDateRangeResponse | null;- results: MCPToolFailureItem[];+ results: MCPToolTopUserItem[];/** Measured timings for different parts of the query generation process */timings?: QueryTiming[] | null;/** Connector-synced data warehouse sources referenced by this query, if any. */@@ -60411,7 +60455,7 @@ export namespace Schemas {resolved_compare_date_range?: ResolvedDateRangeResponse | null;/** The date range used for the query */resolved_date_range?: ResolvedDateRangeResponse | null;- results: MCPToolFailureOccurrenceItem[];+ results: MCPToolFailureItem[];/** Measured timings for different parts of the query generation process */timings?: QueryTiming[] | null;/** Connector-synced data warehouse sources referenced by this query, if any. */@@ -60421,6 +60465,28 @@ export namespace Schemas {}export interface QueryResponseAlternative92 {+ /** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */+ error?: string | null;+ /** Generated HogQL query. */+ hogql?: string | null;+ /** Modifiers used when performing the query */+ modifiers?: HogQLQueryModifiers | null;+ /** Query status indicates whether next to the provided data, a query is still running. */+ query_status?: QueryStatus | null;+ /** The resolved previous/comparison period date range, when comparing against another period */+ resolved_compare_date_range?: ResolvedDateRangeResponse | null;+ /** The date range used for the query */+ resolved_date_range?: ResolvedDateRangeResponse | null;+ results: MCPToolFailureOccurrenceItem[];+ /** Measured timings for different parts of the query generation process */+ timings?: QueryTiming[] | null;+ /** Connector-synced data warehouse sources referenced by this query, if any. */+ used_data_warehouse_sources?: DataWarehouseSourceUsage[] | null;+ /** Warnings about data warehouse sources referenced by the query whose latest sync failed, is paused, hit a billing limit, or is otherwise stale. Results may not reflect current source data. Accumulated across every HogQL execution that contributes to this response — so insights backed by warehouse tables (Trends, Funnels, etc.) receive the same warnings as raw HogQL queries. Also carries access control warnings when a system-table query filters out objects the user can't access. */+ warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;+ }++ export interface QueryResponseAlternative93 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -60443,7 +60509,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative93 {+ export interface QueryResponseAlternative94 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -60465,7 +60531,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative94 {+ export interface QueryResponseAlternative95 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -60487,7 +60553,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative95 {+ export interface QueryResponseAlternative96 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -60509,7 +60575,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative96 {+ export interface QueryResponseAlternative97 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -60531,7 +60597,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative97 {+ export interface QueryResponseAlternative98 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -60553,7 +60619,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative98 {+ export interface QueryResponseAlternative99 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -60575,7 +60641,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative99 {+ export interface QueryResponseAlternative100 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -60597,7 +60663,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative100 {+ export interface QueryResponseAlternative101 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -60619,7 +60685,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative101 {+ export interface QueryResponseAlternative102 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -60641,18 +60707,18 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export type QueryResponseAlternative = { [key: string]: unknown } | QueryResponseAlternative1 | QueryResponseAlternative2 | QueryResponseAlternative3 | QueryResponseAlternative4 | QueryResponseAlternative5 | QueryResponseAlternative6 | QueryResponseAlternative7 | QueryResponseAlternative8 | QueryResponseAlternative9 | QueryResponseAlternative10 | QueryResponseAlternative11 | QueryResponseAlternative12 | QueryResponseAlternative13 | QueryResponseAlternative14 | QueryResponseAlternative15 | QueryResponseAlternative16 | QueryResponseAlternative17 | QueryResponseAlternative18 | QueryResponseAlternative19 | QueryResponseAlternative20 | QueryResponseAlternative21 | QueryResponseAlternative22 | QueryResponseAlternative23 | QueryResponseAlternative24 | QueryResponseAlternative25 | QueryResponseAlternative26 | QueryResponseAlternative27 | QueryResponseAlternative28 | QueryResponseAlternative29 | QueryResponseAlternative30 | QueryResponseAlternative31 | QueryResponseAlternative32 | unknown | QueryResponseAlternative33 | QueryResponseAlternative34 | QueryResponseAlternative35 | QueryResponseAlternative36 | QueryResponseAlternative37 | QueryResponseAlternative38 | QueryResponseAlternative39 | QueryResponseAlternative40 | QueryResponseAlternative41 | QueryResponseAlternative42 | QueryResponseAlternative43 | QueryResponseAlternative44 | QueryResponseAlternative45 | QueryResponseAlternative46 | QueryResponseAlternative47 | QueryResponseAlternative48 | QueryResponseAlternative50 | QueryResponseAlternative51 | QueryResponseAlternative52 | QueryResponseAlternative54 | QueryResponseAlternative55 | QueryResponseAlternative56 | QueryResponseAlternative57 | QueryResponseAlternative58 | QueryResponseAlternative59 | QueryResponseAlternative60 | QueryResponseAlternative62 | QueryResponseAlternative63 | QueryResponseAlternative64 | QueryResponseAlternative65 | QueryResponseAlternative66 | QueryResponseAlternative67 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative72 | QueryResponseAlternative73 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative82 | QueryResponseAlternative83 | QueryResponseAlternative84 | QueryResponseAlternative85 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative88 | QueryResponseAlternative89 | QueryResponseAlternative90 | QueryResponseAlternative91 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101;+ export type QueryResponseAlternative = { [key: string]: unknown } | QueryResponseAlternative1 | QueryResponseAlternative2 | QueryResponseAlternative3 | QueryResponseAlternative4 | QueryResponseAlternative5 | QueryResponseAlternative6 | QueryResponseAlternative7 | QueryResponseAlternative8 | QueryResponseAlternative9 | QueryResponseAlternative10 | QueryResponseAlternative11 | QueryResponseAlternative12 | QueryResponseAlternative13 | QueryResponseAlternative14 | QueryResponseAlternative15 | QueryResponseAlternative16 | QueryResponseAlternative17 | QueryResponseAlternative18 | QueryResponseAlternative19 | QueryResponseAlternative20 | QueryResponseAlternative21 | QueryResponseAlternative22 | QueryResponseAlternative23 | QueryResponseAlternative24 | QueryResponseAlternative25 | QueryResponseAlternative26 | QueryResponseAlternative27 | QueryResponseAlternative28 | QueryResponseAlternative29 | QueryResponseAlternative30 | QueryResponseAlternative31 | QueryResponseAlternative32 | unknown | QueryResponseAlternative33 | QueryResponseAlternative34 | QueryResponseAlternative35 | QueryResponseAlternative36 | QueryResponseAlternative37 | QueryResponseAlternative38 | QueryResponseAlternative39 | QueryResponseAlternative40 | QueryResponseAlternative41 | QueryResponseAlternative42 | QueryResponseAlternative43 | QueryResponseAlternative44 | QueryResponseAlternative45 | QueryResponseAlternative46 | QueryResponseAlternative47 | QueryResponseAlternative48 | QueryResponseAlternative50 | QueryResponseAlternative51 | QueryResponseAlternative52 | QueryResponseAlternative54 | QueryResponseAlternative55 | QueryResponseAlternative56 | QueryResponseAlternative57 | QueryResponseAlternative58 | QueryResponseAlternative59 | QueryResponseAlternative60 | QueryResponseAlternative62 | QueryResponseAlternative63 | QueryResponseAlternative64 | QueryResponseAlternative65 | QueryResponseAlternative66 | QueryResponseAlternative67 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative72 | QueryResponseAlternative73 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative82 | QueryResponseAlternative83 | QueryResponseAlternative84 | QueryResponseAlternative85 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative88 | QueryResponseAlternative89 | QueryResponseAlternative90 | QueryResponseAlternative91 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101 | QueryResponseAlternative102;export interface QueryStatusResponse {query_status: QueryStatus;}export interface QueryUpgradeRequest {- query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | PropertyValuesQuery;+ query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | PropertyValuesQuery;}export interface QueryUpgradeResponse {- query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | PropertyValuesQuery;+ query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebBotsTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | DataVisualizationNode | DataTableNode | SavedInsightNode | InsightVizNode | TrendsQuery | FunnelsQuery | RetentionQuery | PathsQuery | StickinessQuery | LifecycleQuery | FunnelCorrelationQuery | DatabaseSchemaQuery | RecordingsQuery | LogsQuery | LogAttributesQuery | LogValuesQuery | MetricsQuery | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | SessionQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPToolCallBreakdownQuery | MCPToolCallsAndErrorsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | PropertyValuesQuery;}export interface QuotaResourceLimit {