: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): add failure-occurrences query for tool error drill-down (#71317)
Daniel Visca8fb5a83091e8
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.jsonindex 5d868fc25faa..45c565fdfaf5 100644--- a/frontend/src/queries/schema.json+++ b/frontend/src/queries/schema.json@@ -1043,6 +1043,9 @@{"$ref": "#/definitions/MCPToolFailuresQuery"},+ {+ "$ref": "#/definitions/MCPToolFailureOccurrencesQuery"+ },{"$ref": "#/definitions/MCPToolStatsQuery"},@@ -8932,6 +8935,106 @@],"type": "object"},+ "CachedMCPToolFailureOccurrencesQueryResponse": {+ "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/MCPToolFailureOccurrenceItem"+ },+ "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"+ },"CachedMCPToolFailuresQueryResponse": {"additionalProperties": false,"properties": {@@ -30582,6 +30685,14 @@"additionalProperties": false,"description": "One row of the per-tool \"Failures\" table: a failure bucket (error type/status) for a tool.","properties": {+ "error_status": {+ "description": "Raw $mcp_error_status as a string; empty when the bucket has no HTTP status.",+ "type": "string"+ },+ "error_type": {+ "description": "Raw $mcp_error_type bucket (\"unknown\" when the event carries none) — pass to MCPToolFailureOccurrencesQuery.",+ "type": "string"+ },"harnesses": {"description": "Resolved harness labels seen for this failure, deduped and sorted.","items": {@@ -30600,7 +30711,155 @@"$ref": "#/definitions/integer"}},- "required": ["message", "occurrences", "last_seen", "harnesses"],+ "required": ["message", "error_type", "error_status", "occurrences", "last_seen", "harnesses"],+ "type": "object"+ },+ "MCPToolFailureOccurrenceItem": {+ "additionalProperties": false,+ "description": "One individual errored call of a single MCP tool within a failure bucket.",+ "properties": {+ "distinct_id": {+ "type": "string"+ },+ "error_message": {+ "description": "Sanitized error message captured on the event; empty when the event predates message capture.",+ "type": "string"+ },+ "error_status": {+ "description": "Raw $mcp_error_status as a string; empty when absent.",+ "type": "string"+ },+ "harness": {+ "description": "Resolved harness label for the call.",+ "type": "string"+ },+ "intent": {+ "description": "JSON-encoded intent payload as reported by the client; empty when absent.",+ "type": "string"+ },+ "session_id": {+ "description": "Conversation id: $mcp_session_id, falling back to $session_id; empty when neither is set.",+ "type": "string"+ },+ "timestamp": {+ "type": "string"+ }+ },+ "required": [+ "timestamp",+ "distinct_id",+ "session_id",+ "harness",+ "intent",+ "error_message",+ "error_status"+ ],+ "type": "object"+ },+ "MCPToolFailureOccurrencesQuery": {+ "additionalProperties": false,+ "description": "Individual errored calls of a single MCP tool within one failure bucket, newest first.",+ "properties": {+ "dateRange": {+ "$ref": "#/definitions/DateRange"+ },+ "errorStatus": {+ "description": "When set, only events with this HTTP status match; when unset, only events without a status match.",+ "type": "string"+ },+ "errorType": {+ "description": "Raw $mcp_error_type bucket; \"unknown\" selects errored events without an error type.",+ "type": "string"+ },+ "kind": {+ "const": "MCPToolFailureOccurrencesQuery",+ "type": "string"+ },+ "modifiers": {+ "$ref": "#/definitions/HogQLQueryModifiers",+ "description": "Modifiers used when performing the query"+ },+ "response": {+ "$ref": "#/definitions/MCPToolFailureOccurrencesQueryResponse"+ },+ "tags": {+ "$ref": "#/definitions/QueryLogTags"+ },+ "toolName": {+ "description": "The effective tool name to scope to (matched against the single-exec-resolved tool name).",+ "type": "string"+ },+ "version": {+ "description": "version of the node, used for schema migrations",+ "type": "number"+ }+ },+ "required": ["errorType", "kind", "toolName"],+ "type": "object"+ },+ "MCPToolFailureOccurrencesQueryResponse": {+ "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/MCPToolFailureOccurrenceItem"+ },+ "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"},"MCPToolFailuresQuery": {@@ -34799,6 +35058,7 @@"MCPHarnessBreakdownQuery","MCPToolTopUsersQuery","MCPToolFailuresQuery",+ "MCPToolFailureOccurrencesQuery","MCPToolStatsQuery","MCPToolDailyStatsQuery","MCPToolQualityRowsQuery",@@ -43754,6 +44014,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/MCPToolFailureOccurrenceItem"+ },+ "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": {@@ -44664,6 +44989,9 @@{"$ref": "#/definitions/MCPToolFailuresQuery"},+ {+ "$ref": "#/definitions/MCPToolFailureOccurrencesQuery"+ },{"$ref": "#/definitions/MCPToolStatsQuery"},diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.tsindex d8707a5422d1..700f707c5202 100644--- a/frontend/src/queries/schema/schema-general.ts+++ b/frontend/src/queries/schema/schema-general.ts@@ -198,6 +198,7 @@ export enum NodeKind {MCPHarnessBreakdownQuery = 'MCPHarnessBreakdownQuery',MCPToolTopUsersQuery = 'MCPToolTopUsersQuery',MCPToolFailuresQuery = 'MCPToolFailuresQuery',+ MCPToolFailureOccurrencesQuery = 'MCPToolFailureOccurrencesQuery',MCPToolStatsQuery = 'MCPToolStatsQuery',MCPToolDailyStatsQuery = 'MCPToolDailyStatsQuery',MCPToolQualityRowsQuery = 'MCPToolQualityRowsQuery',@@ -279,6 +280,7 @@ export type AnyDataNode =| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuery@@ -406,6 +408,7 @@ export type QuerySchema =| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuery@@ -2751,6 +2754,10 @@ export type CachedMCPToolTopUsersQueryResponse = CachedQueryResponse<MCPToolTopUexport interface MCPToolFailureItem {/** Failure label composed from $mcp_error_type and, when present, $mcp_error_status (e.g. "api_5xx (HTTP 500)"). */message: string+ /** Raw $mcp_error_type bucket ("unknown" when the event carries none) — pass to MCPToolFailureOccurrencesQuery. */+ error_type: string+ /** Raw $mcp_error_status as a string; empty when the bucket has no HTTP status. */+ error_status: stringoccurrences: integerlast_seen: string/** Resolved harness labels seen for this failure, deduped and sorted. */@@ -2771,6 +2778,40 @@ export interface MCPToolFailuresQuery extends DataNode<MCPToolFailuresQueryRespoexport type CachedMCPToolFailuresQueryResponse = CachedQueryResponse<MCPToolFailuresQueryResponse>+/** One individual errored call of a single MCP tool within a failure bucket. */+export interface MCPToolFailureOccurrenceItem {+ timestamp: string+ distinct_id: string+ /** Conversation id: $mcp_session_id, falling back to $session_id; empty when neither is set. */+ session_id: string+ /** Resolved harness label for the call. */+ harness: string+ /** JSON-encoded intent payload as reported by the client; empty when absent. */+ intent: string+ /** Sanitized error message captured on the event; empty when the event predates message capture. */+ error_message: string+ /** Raw $mcp_error_status as a string; empty when absent. */+ error_status: string+}++export interface MCPToolFailureOccurrencesQueryResponse extends AnalyticsQueryResponseBase {+ results: MCPToolFailureOccurrenceItem[]+}++/** Individual errored calls of a single MCP tool within one failure bucket, newest first. */+export interface MCPToolFailureOccurrencesQuery extends DataNode<MCPToolFailureOccurrencesQueryResponse> {+ kind: NodeKind.MCPToolFailureOccurrencesQuery+ /** The effective tool name to scope to (matched against the single-exec-resolved tool name). */+ toolName: string+ /** Raw $mcp_error_type bucket; "unknown" selects errored events without an error type. */+ errorType: string+ /** When set, only events with this HTTP status match; when unset, only events without a status match. */+ errorStatus?: string+ dateRange?: DateRange+}++export type CachedMCPToolFailureOccurrencesQueryResponse = CachedQueryResponse<MCPToolFailureOccurrencesQueryResponse>+/** Summary scalars for a single MCP tool: activity, latency, reach, and intent coverage. */export interface MCPToolStatsItem {calls: integerdiff --git a/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx b/frontend/src/scenes/saved-insights/insightTypesMetadata.tsxindex 1f444ab0303b..8b925ffd884c 100644--- a/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx+++ b/frontend/src/scenes/saved-insights/insightTypesMetadata.tsx@@ -628,6 +628,12 @@ export const QUERY_TYPES_METADATA: Record<NodeKind, InsightTypeMetadata> = {icon: IconPieChart,inMenu: false,},+ [NodeKind.MCPToolFailureOccurrencesQuery]: {+ name: 'MCP tool failure occurrences',+ description: 'Individual errored calls within one failure bucket of an MCP tool.',+ icon: IconPieChart,+ inMenu: false,+ },[NodeKind.MCPToolQualityRowsQuery]: {name: 'MCP tool quality rows',description: 'Per-tool quality metrics for the Tool quality tab.',diff --git a/posthog/api/query.py b/posthog/api/query.pyindex 6164240de833..6ac43470411c 100644--- a/posthog/api/query.py+++ b/posthog/api/query.py@@ -163,6 +163,9 @@ def _process_query_request(# the generic endpoint._QUERY_KIND_SCOPES: dict[str, list[str]] = {"MetricsQuery": ["metrics:read"],+ # Both scopes listed: this result replaces the view's default query:read+ # rather than adding to it, and a token must hold every listed scope.+ "MCPToolFailureOccurrencesQuery": ["query:read", "mcp_analytics:read"],}diff --git a/posthog/clickhouse/query_tagging.py b/posthog/clickhouse/query_tagging.pyindex e90dc66a3e11..cc72ab2e6d56 100644--- a/posthog/clickhouse/query_tagging.py+++ b/posthog/clickhouse/query_tagging.py@@ -277,6 +277,7 @@ def kind_fallback_tags(kind: NodeKind) -> FallbackTags | None:NodeKind.MCP_HARNESS_BREAKDOWN_QUERY| NodeKind.MCP_TOOL_TOP_USERS_QUERY| NodeKind.MCP_TOOL_FAILURES_QUERY+ | NodeKind.MCP_TOOL_FAILURE_OCCURRENCES_QUERY| NodeKind.MCP_TOOL_STATS_QUERY| NodeKind.MCP_TOOL_DAILY_STATS_QUERY| NodeKind.MCP_TOOL_QUALITY_ROWS_QUERYdiff --git a/posthog/hogql_queries/query_runner.py b/posthog/hogql_queries/query_runner.pyindex c90b8e45b8d7..bf666f965da3 100644--- a/posthog/hogql_queries/query_runner.py+++ b/posthog/hogql_queries/query_runner.py@@ -49,6 +49,7 @@ from posthog.schema import (MCPToolCategoryCountsQuery,MCPToolDailyStatsQuery,MCPToolDescriptionsQuery,+ MCPToolFailureOccurrencesQuery,MCPToolFailuresQuery,MCPToolNeighborsQuery,MCPToolQualityDailyStatsQuery,@@ -356,6 +357,7 @@ RunnableQueryNode = Union[MCPHarnessBreakdownQuery,MCPToolTopUsersQuery,MCPToolFailuresQuery,+ MCPToolFailureOccurrencesQuery,MCPToolStatsQuery,MCPToolDailyStatsQuery,MCPToolQualityRowsQuery,@@ -1038,6 +1040,17 @@ def get_query_runner(modifiers=modifiers,user=user,)+ if kind == "MCPToolFailureOccurrencesQuery":+ from products.mcp_analytics.backend.facade.queries import MCPToolFailureOccurrencesQueryRunner++ return MCPToolFailureOccurrencesQueryRunner(+ query=cast(MCPToolFailureOccurrencesQuery | dict[str, Any], query),+ team=team,+ timings=timings,+ limit_context=limit_context,+ modifiers=modifiers,+ user=user,+ )if kind == "MCPToolStatsQuery":from products.mcp_analytics.backend.facade.queries import MCPToolStatsQueryRunnerdiff --git a/posthog/schema.py b/posthog/schema.pyindex 5b7eb575d8ba..d395ff88b63b 100644--- a/posthog/schema.py+++ b/posthog/schema.py@@ -1626,6 +1626,28 @@ class MCPToolDescriptionItem(BaseModel):last_seen: str+class MCPToolFailureOccurrenceItem(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ distinct_id: str+ error_message: str = Field(+ ...,+ description=("Sanitized error message captured on the event; empty when the event predates message capture."),+ )+ error_status: str = Field(..., description="Raw $mcp_error_status as a string; empty when absent.")+ harness: str = Field(..., description="Resolved harness label for the call.")+ intent: str = Field(+ ...,+ description=("JSON-encoded intent payload as reported by the client; empty when absent."),+ )+ session_id: str = Field(+ ...,+ description=("Conversation id: $mcp_session_id, falling back to $session_id; empty when neither is set."),+ )+ timestamp: str++class MCPToolSampleIntentItem(BaseModel):model_config = ConfigDict(extra="forbid",@@ -5344,6 +5366,17 @@ class MCPToolFailureItem(BaseModel):model_config = ConfigDict(extra="forbid",)+ error_status: str = Field(+ ...,+ description=("Raw $mcp_error_status as a string; empty when the bucket has no HTTP status."),+ )+ error_type: str = Field(+ ...,+ description=(+ 'Raw $mcp_error_type bucket ("unknown" when the event carries none) — pass'+ " to MCPToolFailureOccurrencesQuery."+ ),+ )harnesses: list[str] = Field(...,description=("Resolved harness labels seen for this failure, deduped and sorted."),@@ -11394,6 +11427,64 @@ class CachedMCPToolDescriptionsQueryResponse(BaseModel):)+class CachedMCPToolFailureOccurrencesQueryResponse(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[MCPToolFailureOccurrenceItem]+ 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 CachedMCPToolFailuresQueryResponse(BaseModel):model_config = ConfigDict(extra="forbid",@@ -17490,6 +17581,53 @@ class MCPToolDescriptionsQueryResponse(BaseModel):)+class MCPToolFailureOccurrencesQueryResponse(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 MCPToolFailuresQueryResponse(BaseModel):model_config = ConfigDict(extra="forbid",@@ -22257,6 +22395,53 @@ class QueryResponseAlternative101(BaseModel):class QueryResponseAlternative102(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 QueryResponseAlternative103(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -22306,7 +22491,7 @@ class QueryResponseAlternative102(BaseModel):)-class QueryResponseAlternative103(BaseModel):+class QueryResponseAlternative104(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -22353,7 +22538,7 @@ class QueryResponseAlternative103(BaseModel):)-class QueryResponseAlternative104(BaseModel):+class QueryResponseAlternative105(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -22400,7 +22585,7 @@ class QueryResponseAlternative104(BaseModel):)-class QueryResponseAlternative105(BaseModel):+class QueryResponseAlternative106(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -22447,7 +22632,7 @@ class QueryResponseAlternative105(BaseModel):)-class QueryResponseAlternative106(BaseModel):+class QueryResponseAlternative107(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -22494,7 +22679,7 @@ class QueryResponseAlternative106(BaseModel):)-class QueryResponseAlternative107(BaseModel):+class QueryResponseAlternative108(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -22541,7 +22726,7 @@ class QueryResponseAlternative107(BaseModel):)-class QueryResponseAlternative108(BaseModel):+class QueryResponseAlternative109(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -22588,7 +22773,7 @@ class QueryResponseAlternative108(BaseModel):)-class QueryResponseAlternative109(BaseModel):+class QueryResponseAlternative110(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -22635,7 +22820,7 @@ class QueryResponseAlternative109(BaseModel):)-class QueryResponseAlternative110(BaseModel):+class QueryResponseAlternative111(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -22682,7 +22867,7 @@ class QueryResponseAlternative110(BaseModel):)-class QueryResponseAlternative111(BaseModel):+class QueryResponseAlternative112(BaseModel):model_config = ConfigDict(extra="forbid",)@@ -25043,6 +25228,32 @@ class MCPToolDescriptionsQuery(BaseModel):version: float | None = Field(default=None, description="version of the node, used for schema migrations")+class MCPToolFailureOccurrencesQuery(BaseModel):+ model_config = ConfigDict(+ extra="forbid",+ )+ dateRange: DateRange | None = None+ errorStatus: str | None = Field(+ default=None,+ description=(+ "When set, only events with this HTTP status match; when unset, only events without a status match."+ ),+ )+ errorType: str = Field(+ ...,+ description=('Raw $mcp_error_type bucket; "unknown" selects errored events without an error type.'),+ )+ kind: Literal["MCPToolFailureOccurrencesQuery"] = "MCPToolFailureOccurrencesQuery"+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")+ response: MCPToolFailureOccurrencesQueryResponse | None = None+ tags: QueryLogTags | None = None+ toolName: str = Field(+ ...,+ description=("The effective tool name to scope to (matched against the single-exec-resolved tool name)."),+ )+ version: float | None = Field(default=None, description="version of the node, used for schema migrations")++class MCPToolFailuresQuery(BaseModel):model_config = ConfigDict(extra="forbid",@@ -27431,6 +27642,7 @@ class QueryResponseAlternative(| QueryResponseAlternative109| QueryResponseAlternative110| QueryResponseAlternative111+ | QueryResponseAlternative112]):root: (@@ -27539,6 +27751,7 @@ class QueryResponseAlternative(| QueryResponseAlternative109| QueryResponseAlternative110| QueryResponseAlternative111+ | QueryResponseAlternative112)@@ -28506,6 +28719,7 @@ class HogQLAutocomplete(BaseModel):| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuery@@ -28613,6 +28827,7 @@ class HogQLMetadata(BaseModel):| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuery@@ -28752,6 +28967,7 @@ class MaxInsightContext(BaseModel):| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuery@@ -28887,6 +29103,7 @@ class QueryRequest(BaseModel):| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuery@@ -29014,6 +29231,7 @@ class QuerySchemaRoot(| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuery@@ -29111,6 +29329,7 @@ class QuerySchemaRoot(| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuery@@ -29213,6 +29432,7 @@ class QueryUpgradeRequest(BaseModel):| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuery@@ -29315,6 +29535,7 @@ class QueryUpgradeResponse(BaseModel):| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuery@@ -29599,6 +29820,7 @@ class VisualizationArtifactContent(BaseModel):| MCPHarnessBreakdownQuery| MCPToolTopUsersQuery| MCPToolFailuresQuery+ | MCPToolFailureOccurrencesQuery| MCPToolStatsQuery| MCPToolDailyStatsQuery| MCPToolQualityRowsQuerydiff --git a/posthog/schema_enums.py b/posthog/schema_enums.pyindex c47ac2d8e992..5dc96019cffb 100644--- a/posthog/schema_enums.py+++ b/posthog/schema_enums.py@@ -3209,6 +3209,7 @@ class NodeKind(StrEnum):MCP_HARNESS_BREAKDOWN_QUERY = "MCPHarnessBreakdownQuery"MCP_TOOL_TOP_USERS_QUERY = "MCPToolTopUsersQuery"MCP_TOOL_FAILURES_QUERY = "MCPToolFailuresQuery"+ MCP_TOOL_FAILURE_OCCURRENCES_QUERY = "MCPToolFailureOccurrencesQuery"MCP_TOOL_STATS_QUERY = "MCPToolStatsQuery"MCP_TOOL_DAILY_STATS_QUERY = "MCPToolDailyStatsQuery"MCP_TOOL_QUALITY_ROWS_QUERY = "MCPToolQualityRowsQuery"diff --git a/products/mcp_analytics/backend/facade/queries.py b/products/mcp_analytics/backend/facade/queries.pyindex c3802ac62479..1fdf5d61bca2 100644--- a/products/mcp_analytics/backend/facade/queries.py+++ b/products/mcp_analytics/backend/facade/queries.py@@ -15,6 +15,7 @@ from products.mcp_analytics.backend.hogql_queries.tool_quality_tables import (from products.mcp_analytics.backend.hogql_queries.tool_tables import (MCPToolDailyStatsQueryRunner,MCPToolDescriptionsQueryRunner,+ MCPToolFailureOccurrencesQueryRunner,MCPToolFailuresQueryRunner,MCPToolNeighborsQueryRunner,MCPToolSampleIntentsQueryRunner,@@ -28,6 +29,7 @@ __all__ = ["MCPToolCategoryCountsQueryRunner","MCPToolDailyStatsQueryRunner","MCPToolDescriptionsQueryRunner",+ "MCPToolFailureOccurrencesQueryRunner","MCPToolFailuresQueryRunner","MCPToolNeighborsQueryRunner","MCPToolQualityDailyStatsQueryRunner",diff --git a/products/mcp_analytics/backend/hogql_queries/tool_tables.py b/products/mcp_analytics/backend/hogql_queries/tool_tables.pyindex 00e95a858ed9..ecd43f709ab0 100644--- a/products/mcp_analytics/backend/hogql_queries/tool_tables.py+++ b/products/mcp_analytics/backend/hogql_queries/tool_tables.py@@ -12,6 +12,7 @@ from typing import TYPE_CHECKINGfrom posthog.schema import (CachedMCPToolDailyStatsQueryResponse,CachedMCPToolDescriptionsQueryResponse,+ CachedMCPToolFailureOccurrencesQueryResponse,CachedMCPToolFailuresQueryResponse,CachedMCPToolNeighborsQueryResponse,CachedMCPToolSampleIntentsQueryResponse,@@ -24,6 +25,9 @@ from posthog.schema import (MCPToolDescriptionsQuery,MCPToolDescriptionsQueryResponse,MCPToolFailureItem,+ MCPToolFailureOccurrenceItem,+ MCPToolFailureOccurrencesQuery,+ MCPToolFailureOccurrencesQueryResponse,MCPToolFailuresQuery,MCPToolFailuresQueryResponse,MCPToolNeighborItem,@@ -76,20 +80,17 @@ _EFFECTIVE_DESCRIPTION = (# token only has to be materialized once as `h`._HARNESS_LABELS_AGG = f"arraySort(arrayDistinct(groupArray({mcp_harness.harness_label_sql('h')})))"-# Human-readable failure label for an errored $mcp_tool_call. There is no free-text error-# message on tool-call events — the SDK stamps a semantic bucket ($mcp_error_type: internal,-# validation, api_4xx, api_5xx, permission, timeout, rate_limited, missing_context) plus an-# optional HTTP status ($mcp_error_status). We compose the two into one label, falling back to-# "unknown" when neither is present (older SDKs / server paths that only set $mcp_is_error).-# Both properties are event-supplied and unbounded, so the query caps the label at 200 chars-# before grouping on it.-_FAILURE_LABEL = (- "concat("- "coalesce(nullIf(toString(properties.$mcp_error_type), ''), 'unknown'), "- "if(empty(coalesce(toString(properties.$mcp_error_status), '')), '', "- "concat(' (HTTP ', coalesce(toString(properties.$mcp_error_status), ''), ')'))"- ")"-)+# Raw failure-bucket parts of an errored $mcp_tool_call: the SDK stamps a semantic bucket+# ($mcp_error_type: internal, validation, api_4xx, api_5xx, permission, timeout, rate_limited,+# missing_context) plus an optional HTTP status ($mcp_error_status), falling back to "unknown"+# when neither is present (older SDKs / server paths that only set $mcp_is_error). Both+# properties are event-supplied and unbounded, so they are capped before grouping/filtering —+# an attacker emitting huge unique values must not inflate the grouping key or response size.+# The failures table groups on the raw parts and composes the display label from them, so the+# occurrences drill-down can requery a bucket by the same normalized parts without label parsing.+_RAW_ERROR_TYPE = "substring(coalesce(nullIf(toString(properties.$mcp_error_type), ''), 'unknown'), 1, 200)"+_RAW_ERROR_STATUS = "substring(coalesce(toString(properties.$mcp_error_status), ''), 1, 20)"+_COMPOSED_FAILURE_LABEL = "concat(error_type, if(empty(error_status), '', concat(' (HTTP ', error_status, ')')))"def _display_properties(*, email: str, name: str) -> str:@@ -226,25 +227,30 @@ class MCPToolFailuresQueryRunner(AnalyticsQueryRunner[MCPToolFailuresQueryResponreturn parse_select("""SELECT- message,+ {_COMPOSED_FAILURE_LABEL} AS message,+ error_type,+ error_status,count() AS occurrences,max(timestamp) AS last_seen,{_HARNESS_LABELS_AGG} AS harnessesFROM (SELECT- substring({_FAILURE_LABEL}, 1, 200) AS message,+ {_RAW_ERROR_TYPE} AS error_type,+ {_RAW_ERROR_STATUS} AS error_status,timestamp,{token} AS hFROM eventsWHERE {where})- GROUP BY message+ GROUP BY error_type, error_statusORDER BY occurrences DESCLIMIT 20""",placeholders={"_HARNESS_LABELS_AGG": parse_expr(_HARNESS_LABELS_AGG),- "_FAILURE_LABEL": parse_expr(_FAILURE_LABEL),+ "_COMPOSED_FAILURE_LABEL": parse_expr(_COMPOSED_FAILURE_LABEL),+ "_RAW_ERROR_TYPE": parse_expr(_RAW_ERROR_TYPE),+ "_RAW_ERROR_STATUS": parse_expr(_RAW_ERROR_STATUS),"token": parse_expr(mcp_harness.HARNESS_TOKEN_SQL),"where": self._where(),},@@ -269,9 +275,11 @@ class MCPToolFailuresQueryRunner(AnalyticsQueryRunner[MCPToolFailuresQueryResponresults = [MCPToolFailureItem(message=str(row[0] or ""),- occurrences=int(row[1] or 0),- last_seen=str(row[2] or ""),- harnesses=[str(h) for h in (row[3] or [])],+ error_type=str(row[1] or ""),+ error_status=str(row[2] or ""),+ occurrences=int(row[3] or 0),+ last_seen=str(row[4] or ""),+ harnesses=[str(h) for h in (row[5] or [])],)for row in (response.results or [])]@@ -284,6 +292,124 @@ class MCPToolFailuresQueryRunner(AnalyticsQueryRunner[MCPToolFailuresQueryRespon_CONVERSATION_ID = "coalesce(nullIf(toString(properties.$mcp_session_id), ''), toString(properties.$session_id))"++# Mirrors the capture-side MAX_ERROR_MESSAGE_LENGTH (services/mcp); event-supplied, so+# re-capped here in case a non-PostHog server emits an unbounded value.+_ERROR_MESSAGE = "substring(coalesce(toString(properties.$mcp_error_message), ''), 1, 2048)"+++class MCPToolFailureOccurrencesQueryRunner(AnalyticsQueryRunner[MCPToolFailureOccurrencesQueryResponse]):+ query: MCPToolFailureOccurrencesQuery+ cached_response: CachedMCPToolFailureOccurrencesQueryResponse++ 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)++ def _where(self) -> ast.Expr:+ # Bucket predicates normalize exactly like the failures table's grouping key, so a row+ # from that table always round-trips to its own occurrences. Values are bound as+ # ast.Constant, never interpolated.+ extra: list[ast.Expr] = [+ parse_expr("toBool(properties.$mcp_is_error)"),+ parse_expr(+ "{raw_type} = {error_type}",+ placeholders={+ "raw_type": parse_expr(_RAW_ERROR_TYPE),+ "error_type": ast.Constant(value=self.query.errorType),+ },+ ),+ ]+ if self.query.errorStatus:+ extra.append(+ parse_expr(+ "{raw_status} = {error_status}",+ placeholders={+ "raw_status": parse_expr(_RAW_ERROR_STATUS),+ "error_status": ast.Constant(value=self.query.errorStatus),+ },+ )+ )+ else:+ extra.append(parse_expr("empty({raw_status})", placeholders={"raw_status": parse_expr(_RAW_ERROR_STATUS)}))+ return _tool_call_where(self.query.toolName, self.query_date_range, extra=extra)++ def to_query(self) -> ast.SelectQuery | ast.SelectSetQuery:+ return parse_select(+ """+ SELECT+ toString(timestamp) AS ts,+ distinct_id,+ session_id,+ {harness_label} AS harness,+ intent,+ error_message,+ error_status+ FROM (+ SELECT+ timestamp,+ distinct_id,+ substring({_CONVERSATION_ID}, 1, 200) AS session_id,+ if(toString(properties.$mcp_intent) = '{}', '', substring(toString(properties.$mcp_intent), 1, 1000)) AS intent,+ {_ERROR_MESSAGE} AS error_message,+ {_RAW_ERROR_STATUS} AS error_status,+ {token} AS h+ FROM events+ WHERE {where}+ )+ ORDER BY ts DESC+ LIMIT 50+ """,+ placeholders={+ "harness_label": parse_expr(mcp_harness.harness_label_sql("h")),+ "_CONVERSATION_ID": parse_expr(_CONVERSATION_ID),+ "_ERROR_MESSAGE": parse_expr(_ERROR_MESSAGE),+ "_RAW_ERROR_STATUS": parse_expr(_RAW_ERROR_STATUS),+ "token": parse_expr(mcp_harness.HARNESS_TOKEN_SQL),+ "where": self._where(),+ },+ )++ def _calculate(self) -> MCPToolFailureOccurrencesQueryResponse:+ with tags_context(+ product=Product.MCP_ANALYTICS,+ feature=Feature.QUERY,+ team_id=self.team.id,+ name="mcp_tool_failure_occurrences_query",+ ):+ response = execute_hogql_query(+ query=self.to_query(),+ team=self.team,+ user=self.user,+ query_type="mcp_tool_failure_occurrences_query",+ timings=self.timings,+ modifiers=self.modifiers,+ limit_context=self.limit_context,+ )++ results = [+ MCPToolFailureOccurrenceItem(+ timestamp=str(row[0] or ""),+ distinct_id=str(row[1] or ""),+ session_id=str(row[2] or ""),+ harness=str(row[3] or ""),+ intent=str(row[4] or ""),+ error_message=str(row[5] or ""),+ error_status=str(row[6] or ""),+ )+ for row in (response.results or [])+ ]+ return MCPToolFailureOccurrencesQueryResponse(+ results=results,+ timings=response.timings,+ hogql=response.hogql,+ modifiers=self.modifiers,+ )++_IS_ERROR = "countIf(toBool(properties.$mcp_is_error))"_P50 = "round(quantile(0.5)(toFloat(properties.$mcp_duration_ms)))"_P95 = "round(quantile(0.95)(toFloat(properties.$mcp_duration_ms)))"diff --git a/products/mcp_analytics/backend/tests/test_tool_tables.py b/products/mcp_analytics/backend/tests/test_tool_tables.pyindex 95646d2e8958..abab52174de7 100644--- a/products/mcp_analytics/backend/tests/test_tool_tables.py+++ b/products/mcp_analytics/backend/tests/test_tool_tables.py@@ -10,6 +10,7 @@ from posthog.schema import (IntervalType,MCPToolDailyStatsQuery,MCPToolDescriptionsQuery,+ MCPToolFailureOccurrencesQuery,MCPToolFailuresQuery,MCPToolNeighborsQuery,MCPToolSampleIntentsQuery,@@ -18,9 +19,13 @@ from posthog.schema import (NeighborDirection,)+from posthog.models.personal_api_key import PersonalAPIKey+from posthog.models.utils import generate_random_token_personal, hash_key_value+from products.mcp_analytics.backend.hogql_queries.tool_tables import (MCPToolDailyStatsQueryRunner,MCPToolDescriptionsQueryRunner,+ MCPToolFailureOccurrencesQueryRunner,MCPToolFailuresQueryRunner,MCPToolNeighborsQueryRunner,MCPToolSampleIntentsQueryRunner,@@ -172,16 +177,22 @@ class TestMCPToolFailuresQueryRunner(_MCPAnalyticsTeamScopedTestMixin, Clickhous@parameterized.expand([- ("type_and_status", "api_5xx", "500", "api_5xx (HTTP 500)"),- ("type_only", "validation", None, "validation"),- ("neither_falls_back_to_unknown", None, None, "unknown"),+ ("type_and_status", "api_5xx", "500", "api_5xx (HTTP 500)", "api_5xx", "500"),+ ("type_only", "validation", None, "validation", "validation", ""),+ ("neither_falls_back_to_unknown", None, None, "unknown", "unknown", ""),# Event-supplied fields are unbounded; the label must be capped so an attacker# emitting huge unique values can't inflate the grouping key and response size.- ("long_type_truncated_to_200_chars", "x" * 300, None, "x" * 200),+ ("long_type_truncated_to_200_chars", "x" * 300, None, "x" * 200, "x" * 200, ""),])def test_composes_failure_label(- self, _name: str, error_type: str | None, error_status: str | None, expected: str+ self,+ _name: str,+ error_type: str | None,+ error_status: str | None,+ expected: str,+ expected_type: str,+ expected_status: str,) -> None:self._emit(error_type=error_type, error_status=error_status, client_name="claude-ai")flush_persons_and_events()@@ -190,6 +201,9 @@ class TestMCPToolFailuresQueryRunner(_MCPAnalyticsTeamScopedTestMixin, Clickhousassert len(rows) == 1assert rows[0].message == expected+ # Raw bucket parts ride along so the drill-down can requery the bucket without parsing the label.+ assert rows[0].error_type == expected_type+ assert rows[0].error_status == expected_statusdef test_only_counts_errored_calls(self) -> None:# The fix's core behavior: failures are sourced from $mcp_is_error on $mcp_tool_call,@@ -235,6 +249,156 @@ class TestMCPToolFailuresQueryRunner(_MCPAnalyticsTeamScopedTestMixin, Clickhousassert {r.message for r in self._run()} == {"validation"}+class TestMCPToolFailureOccurrencesQueryRunner(_MCPAnalyticsTeamScopedTestMixin, ClickhouseTestMixin, APIBaseTest):+ def _emit(+ self,+ *,+ tool_name: str = "query_run",+ distinct_id: str = "d1",+ client_name: str | None = None,+ source: str | None = NEW_SDK_SOURCE,+ is_error: bool = True,+ error_type: str | None = None,+ error_status: str | None = None,+ error_message: str | None = None,+ session_id: str | None = None,+ intent: str | None = None,+ exec_tool: str | None = None,+ timestamp: datetime | None = None,+ ) -> None:+ properties: dict[str, Any] = {"$mcp_tool_name": tool_name, "$mcp_is_error": is_error}+ if source is not None:+ properties["$mcp_source"] = source+ if client_name is not None:+ properties["$mcp_client_name"] = client_name+ if error_type is not None:+ properties["$mcp_error_type"] = error_type+ if error_status is not None:+ properties["$mcp_error_status"] = error_status+ if error_message is not None:+ properties["$mcp_error_message"] = error_message+ if session_id is not None:+ properties["$mcp_session_id"] = session_id+ if intent is not None:+ properties["$mcp_intent"] = intent+ if exec_tool is not None:+ properties["$mcp_exec_tool_call_name"] = exec_tool+ _create_event(+ team=self.team,+ event="$mcp_tool_call",+ distinct_id=distinct_id,+ timestamp=timestamp or datetime.now(tz=UTC),+ properties=properties,+ )++ def _run(self, error_type: str, error_status: str | None = None, tool_name: str = "query_run") -> list[Any]:+ runner = MCPToolFailureOccurrencesQueryRunner(+ query=MCPToolFailureOccurrencesQuery(+ toolName=tool_name,+ errorType=error_type,+ errorStatus=error_status,+ dateRange=DateRange(date_from="-7d"),+ ),+ team=self.team,+ )+ return runner.calculate().results++ @parameterized.expand(+ [+ # The no-status branch must not match statused events in the same error type, and vice versa.+ ("statused_bucket", "api_5xx", "500", {"d500"}),+ ("no_status_bucket_within_type", "api_5xx", None, {"dnostatus"}),+ ("typeless_events_form_unknown_bucket", "unknown", None, {"dtypeless"}),+ ]+ )+ def test_filters_to_exactly_one_bucket(+ self, _name: str, query_type: str, query_status: str | None, expected_ids: set[str]+ ) -> None:+ self._emit(distinct_id="d500", error_type="api_5xx", error_status="500")+ self._emit(distinct_id="d502", error_type="api_5xx", error_status="502")+ self._emit(distinct_id="dnostatus", error_type="api_5xx")+ self._emit(distinct_id="dtypeless")+ self._emit(distinct_id="dother", error_type="internal")+ flush_persons_and_events()++ rows = self._run(query_type, query_status)++ assert {r.distinct_id for r in rows} == expected_ids++ def test_carries_event_fields_newest_first_with_empty_message_fallback(self) -> None:+ now = datetime.now(tz=UTC)+ self._emit(+ distinct_id="d1",+ error_type="internal",+ error_message="boom: table not found",+ session_id="conv1",+ intent='{"goal":"x"}',+ client_name="claude-ai (via mcp-remote 0.1.37)",+ timestamp=now,+ )+ # Pre-capture event: no $mcp_error_message on the event must surface as an empty string.+ # '{}' is the SDK's no-intent sentinel — normalized to empty like the sibling runners.+ self._emit(distinct_id="d2", error_type="internal", intent="{}", timestamp=now - timedelta(minutes=5))+ flush_persons_and_events()++ rows = self._run("internal")++ assert [r.distinct_id for r in rows] == ["d1", "d2"]+ assert rows[0].error_message == "boom: table not found"+ assert rows[0].session_id == "conv1"+ assert "goal" in rows[0].intent+ assert rows[0].harness == "Claude.ai"+ assert rows[1].error_message == ""+ assert rows[1].intent == ""++ def test_caps_event_supplied_session_id_and_intent_lengths(self) -> None:+ self._emit(+ distinct_id="d1",+ error_type="internal",+ session_id="s" * 500,+ intent='{"goal":"' + "x" * 2000 + '"}',+ )+ flush_persons_and_events()++ rows = self._run("internal")++ assert len(rows) == 1+ assert len(rows[0].session_id) == 200+ assert len(rows[0].intent) == 1000++ @parameterized.expand(+ [+ (["query:read"], 403),+ (["mcp_analytics:read"], 403),+ (["query:read", "mcp_analytics:read"], 200),+ ]+ )+ def test_query_endpoint_scope_parity_for_api_keys(self, 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)++ response = self.client.post(+ f"/api/projects/{self.team.pk}/query/",+ {"query": {"kind": "MCPToolFailureOccurrencesQuery", "toolName": "query_run", "errorType": "internal"}},+ HTTP_AUTHORIZATION=f"Bearer {value}",+ )++ assert response.status_code == expected_status, response.json()++ def test_excludes_non_errored_other_tools_and_old_sdk_events(self) -> None:+ self._emit(distinct_id="match", error_type="internal")+ self._emit(distinct_id="ok", error_type="internal", is_error=False)+ self._emit(distinct_id="othertool", tool_name="other_tool", error_type="internal")+ self._emit(distinct_id="oldsdk", error_type="internal", source=None)+ # Single-exec wrapper: the effective tool is in $mcp_exec_tool_call_name, not $mcp_tool_name.+ self._emit(distinct_id="viaexec", tool_name="exec", exec_tool="query_run", error_type="internal")+ flush_persons_and_events()++ rows = self._run("internal")++ assert {r.distinct_id for r in rows} == {"match", "viaexec"}++def _emit_tool_call(team: Any,*,diff --git a/products/mcp_analytics/mcp/tools.yaml b/products/mcp_analytics/mcp/tools.yamlindex d9ec93d7a4fc..24dc3f864b8d 100644--- a/products/mcp_analytics/mcp/tools.yaml+++ b/products/mcp_analytics/mcp/tools.yaml@@ -235,10 +235,11 @@ wrappers:description: >Return the most common failure buckets for a single MCP tool, each with the resolved client harness it camefrom. Failures are the errored $mcp_tool_call events ($mcp_is_error = true) — the same source as the error- rate — grouped by $mcp_error_type and HTTP $mcp_error_status (there is no free-text error message on tool- calls). Pass toolName (effective tool name, resolved server-side, matching the other tool-detail tools) and- a dateRange. Use to answer "why is tool X failing?" or "what errors does tool X throw, and on which- clients?".+ rate — grouped by $mcp_error_type and HTTP $mcp_error_status. Each bucket carries the raw error_type and+ error_status, which you can pass to query-mcp-tool-failure-occurrences to see individual errored calls with+ their error messages. Pass toolName (effective tool name, resolved server-side, matching the other+ tool-detail tools) and a dateRange. Use to answer "why is tool X failing?" or "what errors does tool X+ throw, and on which clients?".system_prompt_hint: One MCP tool's top failure buckets, by harness (error type + HTTP status)exclude_properties:- response@@ -246,6 +247,32 @@ wrappers:- version- tagsfeature_flag: mcp-analytics+ query-mcp-tool-failure-occurrences:+ schema_ref: MCPToolFailureOccurrencesQuery+ enabled: true+ scopes:+ - query:read+ - mcp_analytics:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: Individual errored calls in one failure bucket+ description: >+ Return individual errored $mcp_tool_call events for a single MCP tool within one failure bucket, newest+ first (up to 50). Each occurrence carries the timestamp, distinct_id, session id, resolved harness, the+ agent's stated intent, the captured error message ($mcp_error_message — empty on events that predate message+ capture), and the HTTP status. Pass toolName plus the errorType (raw $mcp_error_type; "unknown" for events+ without one) and optional errorStatus exactly as returned by query-mcp-tool-failures — when errorStatus is+ omitted, only events without a status match. Use to answer "show me the actual errors" after a failure+ bucket looks suspicious.+ system_prompt_hint: Individual errored calls (with error messages) for one MCP tool's failure bucket+ exclude_properties:+ - response+ - modifiers+ - version+ - tags+ feature_flag: mcp-analyticsquery-mcp-tool-top-users:schema_ref: MCPToolTopUsersQueryenabled: truediff --git a/products/mcp_analytics/skills/exploring-mcp-tool-quality/SKILL.md b/products/mcp_analytics/skills/exploring-mcp-tool-quality/SKILL.mdindex 637b10a7af3c..c54a46c9720f 100644--- a/products/mcp_analytics/skills/exploring-mcp-tool-quality/SKILL.md+++ b/products/mcp_analytics/skills/exploring-mcp-tool-quality/SKILL.md@@ -90,10 +90,13 @@ under "Tool-quality matrix".For one tool's top failure buckets (grouped by harness), call`posthog:query-mcp-tool-failures` with the `toolName` — it's the typed equivalent of thequery below. Failures come from the **same source as the error rate**: errored-`$mcp_tool_call` events (`$mcp_is_error`), scoped by the effective tool name. There is no-free-text error message on tool calls, so failures are grouped by `$mcp_error_type` (a-semantic bucket: `internal`, `validation`, `api_4xx`, `api_5xx`, `permission`, `timeout`,-`rate_limited`, `missing_context`) and the HTTP `$mcp_error_status` when present:+`$mcp_tool_call` events (`$mcp_is_error`), scoped by the effective tool name. Failures are+grouped by `$mcp_error_type` (a semantic bucket: `internal`, `validation`, `api_4xx`,+`api_5xx`, `permission`, `timeout`, `rate_limited`, `missing_context`) and the HTTP+`$mcp_error_status` when present. To see individual errored calls inside a bucket — with+the captured `$mcp_error_message`, session id, harness, and intent — pass the bucket's raw+`error_type`/`error_status` to `posthog:query-mcp-tool-failure-occurrences`+(`$mcp_error_message` is empty on events captured before message capture shipped):```sqlposthog:execute-sqldiff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-mcp.md b/products/posthog_ai/skills/querying-posthog-data/references/models-mcp.mdindex 700f4080ac3c..2a2d1c7e8391 100644--- a/products/posthog_ai/skills/querying-posthog-data/references/models-mcp.md+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-mcp.md@@ -6,15 +6,16 @@ Query the canonical `$`-prefixed event name. Servers instrumented with the `@pos**For a single tool, prefer the typed tools.** Each takes a `toolName` plus a `dateRange`, runs the same query runner the tool-detail UI uses, and is gated behind the `mcp-analytics` flag, so results match the UI exactly and you don't re-derive the SQL below. `toolName` is the effective name (resolved server-side — the inner tool of a single-exec wrapper call) for all of them, including `posthog:query-mcp-tool-failures`:-| question about one tool | tool |-| ------------------------------------------------------------------- | --------------------------------------- |-| headline numbers (calls, errors, p50/p95, users, sessions, intents) | `posthog:query-mcp-tool-stats` |-| day-by-day trend | `posthog:query-mcp-tool-daily-stats` |-| top failure buckets, by harness | `posthog:query-mcp-tool-failures` |-| top callers (incl. person email/name) | `posthog:query-mcp-tool-top-users` |-| tools called before/after it (`neighborDirection: before`/`after`) | `posthog:query-mcp-tool-neighbors` |-| recent agent intents | `posthog:query-mcp-tool-sample-intents` |-| distinct descriptions seen | `posthog:query-mcp-tool-descriptions` |+| question about one tool | tool |+| ------------------------------------------------------------------- | -------------------------------------------- |+| headline numbers (calls, errors, p50/p95, users, sessions, intents) | `posthog:query-mcp-tool-stats` |+| day-by-day trend | `posthog:query-mcp-tool-daily-stats` |+| top failure buckets, by harness | `posthog:query-mcp-tool-failures` |+| individual errored calls in one failure bucket | `posthog:query-mcp-tool-failure-occurrences` |+| top callers (incl. person email/name) | `posthog:query-mcp-tool-top-users` |+| tools called before/after it (`neighborDirection: before`/`after`) | `posthog:query-mcp-tool-neighbors` |+| recent agent intents | `posthog:query-mcp-tool-sample-intents` |+| distinct descriptions seen | `posthog:query-mcp-tool-descriptions` |And `posthog:query-mcp-harness-breakdown` for the cross-tool harness cut (see below).@@ -58,7 +59,7 @@ And two tools cover what SQL can't express at all: `posthog:mcp-analytics-intentcoalesce(nullIf(toString(properties.$mcp_exec_tool_call_name), ''), toString(properties.$mcp_tool_name))```-**Failures with detail.** `$mcp_tool_call` carries `$mcp_is_error` plus a semantic `$mcp_error_type` and, for HTTP failures, `$mcp_error_status`. `posthog:query-mcp-tool-failures` groups errored tool calls by these two fields. A free-text `$mcp_error_message` / `$mcp_response` exists in the SDK schema but PostHog's hosted server leaves both empty, so don't rely on them for tool-failure detail. PostHog's own tool calls also don't emit `$exception` events — those only exist for separately-instrumented MCP servers.+**Failures with detail.** `$mcp_tool_call` carries `$mcp_is_error` plus a semantic `$mcp_error_type` and, for HTTP failures, `$mcp_error_status`. `posthog:query-mcp-tool-failures` groups errored tool calls by these two fields and returns each bucket's raw `error_type`/`error_status`; pass those to `posthog:query-mcp-tool-failure-occurrences` for individual errored calls with the free-text `$mcp_error_message` (sanitized, truncated to 2048 chars — empty on events captured before PostHog's server started emitting it). `$mcp_response` stays empty on PostHog's hosted server. PostHog's own tool calls also don't emit `$exception` events — those only exist for separately-instrumented MCP servers.## Example queriesdiff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex dc76523e1cdc..a7d5fe4cbe12 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -7180,8 +7180,24 @@"feature_flag": "mcp-analytics","system_prompt_hint": "Distinct effective descriptions seen for one MCP tool"},+ "query-mcp-tool-failure-occurrences": {+ "description": "Return individual errored $mcp_tool_call events for a single MCP tool within one failure bucket, newest first (up to 50). Each occurrence carries the timestamp, distinct_id, session id, resolved harness, the agent's stated intent, the captured error message ($mcp_error_message — empty on events that predate message capture), and the HTTP status. Pass toolName plus the errorType (raw $mcp_error_type; \"unknown\" for events without one) and optional errorStatus exactly as returned by query-mcp-tool-failures — when errorStatus is omitted, only events without a status match. Use to answer \"show me the actual errors\" after a failure bucket looks suspicious.",+ "category": "MCP analytics",+ "feature": "mcp_analytics",+ "summary": "Individual errored calls in one failure bucket",+ "title": "Individual errored calls in one failure bucket",+ "required_scopes": ["query:read", "mcp_analytics:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "mcp-analytics",+ "system_prompt_hint": "Individual errored calls (with error messages) for one MCP tool's failure bucket"+ },"query-mcp-tool-failures": {- "description": "Return the most common failure buckets for a single MCP tool, each with the resolved client harness it came from. Failures are the errored $mcp_tool_call events ($mcp_is_error = true) — the same source as the error rate — grouped by $mcp_error_type and HTTP $mcp_error_status (there is no free-text error message on tool calls). Pass toolName (effective tool name, resolved server-side, matching the other tool-detail tools) and a dateRange. Use to answer \"why is tool X failing?\" or \"what errors does tool X throw, and on which clients?\".",+ "description": "Return the most common failure buckets for a single MCP tool, each with the resolved client harness it came from. Failures are the errored $mcp_tool_call events ($mcp_is_error = true) — the same source as the error rate — grouped by $mcp_error_type and HTTP $mcp_error_status. Each bucket carries the raw error_type and error_status, which you can pass to query-mcp-tool-failure-occurrences to see individual errored calls with their error messages. Pass toolName (effective tool name, resolved server-side, matching the other tool-detail tools) and a dateRange. Use to answer \"why is tool X failing?\" or \"what errors does tool X throw, and on which clients?\".","category": "MCP analytics","feature": "mcp_analytics","summary": "Top errors for one MCP tool",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex e19c1fd22408..7d8040fef9c8 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -7701,8 +7701,24 @@"feature_flag": "mcp-analytics","system_prompt_hint": "Distinct effective descriptions seen for one MCP tool"},+ "query-mcp-tool-failure-occurrences": {+ "description": "Return individual errored $mcp_tool_call events for a single MCP tool within one failure bucket, newest first (up to 50). Each occurrence carries the timestamp, distinct_id, session id, resolved harness, the agent's stated intent, the captured error message ($mcp_error_message — empty on events that predate message capture), and the HTTP status. Pass toolName plus the errorType (raw $mcp_error_type; \"unknown\" for events without one) and optional errorStatus exactly as returned by query-mcp-tool-failures — when errorStatus is omitted, only events without a status match. Use to answer \"show me the actual errors\" after a failure bucket looks suspicious.",+ "category": "MCP analytics",+ "feature": "mcp_analytics",+ "summary": "Individual errored calls in one failure bucket",+ "title": "Individual errored calls in one failure bucket",+ "required_scopes": ["query:read", "mcp_analytics:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "mcp-analytics",+ "system_prompt_hint": "Individual errored calls (with error messages) for one MCP tool's failure bucket"+ },"query-mcp-tool-failures": {- "description": "Return the most common failure buckets for a single MCP tool, each with the resolved client harness it came from. Failures are the errored $mcp_tool_call events ($mcp_is_error = true) — the same source as the error rate — grouped by $mcp_error_type and HTTP $mcp_error_status (there is no free-text error message on tool calls). Pass toolName (effective tool name, resolved server-side, matching the other tool-detail tools) and a dateRange. Use to answer \"why is tool X failing?\" or \"what errors does tool X throw, and on which clients?\".",+ "description": "Return the most common failure buckets for a single MCP tool, each with the resolved client harness it came from. Failures are the errored $mcp_tool_call events ($mcp_is_error = true) — the same source as the error rate — grouped by $mcp_error_type and HTTP $mcp_error_status. Each bucket carries the raw error_type and error_status, which you can pass to query-mcp-tool-failure-occurrences to see individual errored calls with their error messages. Pass toolName (effective tool name, resolved server-side, matching the other tool-detail tools) and a dateRange. Use to answer \"why is tool X failing?\" or \"what errors does tool X throw, and on which clients?\".","category": "MCP analytics","feature": "mcp_analytics","summary": "Top errors for one MCP tool",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 2bc5d46fd7de..8760b33484a4 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -34747,6 +34747,10 @@ export namespace Schemas {}export interface MCPToolFailureItem {+ /** Raw $mcp_error_status as a string; empty when the bucket has no HTTP status. */+ error_status: string;+ /** Raw $mcp_error_type bucket ("unknown" when the event carries none) — pass to MCPToolFailureOccurrencesQuery. */+ error_type: string;/** Resolved harness labels seen for this failure, deduped and sorted. */harnesses: string[];last_seen: string;@@ -34790,6 +34794,60 @@ export namespace Schemas {version?: number | null;}+ export interface MCPToolFailureOccurrenceItem {+ distinct_id: string;+ /** Sanitized error message captured on the event; empty when the event predates message capture. */+ error_message: string;+ /** Raw $mcp_error_status as a string; empty when absent. */+ error_status: string;+ /** Resolved harness label for the call. */+ harness: string;+ /** JSON-encoded intent payload as reported by the client; empty when absent. */+ intent: string;+ /** Conversation id: $mcp_session_id, falling back to $session_id; empty when neither is set. */+ session_id: string;+ timestamp: string;+ }++ export interface MCPToolFailureOccurrencesQueryResponse {+ /** 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 MCPToolFailureOccurrencesQuery {+ dateRange?: DateRange | null;+ /** When set, only events with this HTTP status match; when unset, only events without a status match. */+ errorStatus?: string | null;+ /** Raw $mcp_error_type bucket; "unknown" selects errored events without an error type. */+ errorType: string;+ kind?: 'MCPToolFailureOccurrencesQuery';+ /** Modifiers used when performing the query */+ modifiers?: HogQLQueryModifiers | null;+ response?: MCPToolFailureOccurrencesQueryResponse | null;+ tags?: QueryLogTags | null;+ /** The effective tool name to scope to (matched against the single-exec-resolved tool name). */+ toolName: string;+ /** version of the node, used for schema migrations */+ version?: number | null;+ }+export interface MCPToolStatsItem {calls: number;conversations: number;@@ -35218,7 +35276,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 | RevenueAnalyticsGrossRevenueQuery | RevenueAnalyticsMetricsQuery | RevenueAnalyticsMRRQuery | RevenueAnalyticsOverviewQuery | RevenueAnalyticsTopCustomersQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | RevenueExampleEventsQuery | RevenueExampleDataWarehouseTablesQuery | 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 | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | 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 | RevenueAnalyticsGrossRevenueQuery | RevenueAnalyticsMetricsQuery | RevenueAnalyticsMRRQuery | RevenueAnalyticsOverviewQuery | RevenueAnalyticsTopCustomersQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | RevenueExampleEventsQuery | RevenueExampleDataWarehouseTablesQuery | 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 | 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;@@ -35244,7 +35302,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 | RevenueAnalyticsGrossRevenueQuery | RevenueAnalyticsMetricsQuery | RevenueAnalyticsMRRQuery | RevenueAnalyticsOverviewQuery | RevenueAnalyticsTopCustomersQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | RevenueExampleEventsQuery | RevenueExampleDataWarehouseTablesQuery | 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 | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | 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 | RevenueAnalyticsGrossRevenueQuery | RevenueAnalyticsMetricsQuery | RevenueAnalyticsMRRQuery | RevenueAnalyticsOverviewQuery | RevenueAnalyticsTopCustomersQuery | MarketingAnalyticsTableQuery | MarketingAnalyticsAggregatedQuery | NonIntegratedConversionsTableQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | SessionAttributionExplorerQuery | RevenueExampleEventsQuery | RevenueExampleDataWarehouseTablesQuery | 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 | 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;@@ -56143,7 +56201,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 | RevenueExampleEventsQuery | RevenueExampleDataWarehouseTablesQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | RevenueAnalyticsGrossRevenueQuery | RevenueAnalyticsMetricsQuery | RevenueAnalyticsMRRQuery | RevenueAnalyticsOverviewQuery | RevenueAnalyticsTopCustomersQuery | 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 | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | 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 | RevenueExampleEventsQuery | RevenueExampleDataWarehouseTablesQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | RevenueAnalyticsGrossRevenueQuery | RevenueAnalyticsMetricsQuery | RevenueAnalyticsMRRQuery | RevenueAnalyticsOverviewQuery | RevenueAnalyticsTopCustomersQuery | 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 | 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@@ -58392,6 +58450,28 @@ export namespace Schemas {}export interface QueryResponseAlternative102 {+ /** 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 QueryResponseAlternative103 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -58414,7 +58494,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative103 {+ export interface QueryResponseAlternative104 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -58436,7 +58516,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative104 {+ export interface QueryResponseAlternative105 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -58458,7 +58538,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative105 {+ export interface QueryResponseAlternative106 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -58480,7 +58560,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative106 {+ export interface QueryResponseAlternative107 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -58502,7 +58582,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative107 {+ export interface QueryResponseAlternative108 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -58524,7 +58604,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative108 {+ export interface QueryResponseAlternative109 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -58546,7 +58626,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative109 {+ export interface QueryResponseAlternative110 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -58568,7 +58648,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative110 {+ export interface QueryResponseAlternative111 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -58590,7 +58670,7 @@ export namespace Schemas {warnings?: (DataWarehouseSyncWarning | AccessControlFilterWarning)[] | null;}- export interface QueryResponseAlternative111 {+ export interface QueryResponseAlternative112 {/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */error?: string | null;/** Generated HogQL query. */@@ -58612,18 +58692,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 | QueryResponseAlternative14 | QueryResponseAlternative15 | QueryResponseAlternative16 | QueryResponseAlternative17 | QueryResponseAlternative18 | QueryResponseAlternative19 | QueryResponseAlternative20 | QueryResponseAlternative21 | QueryResponseAlternative22 | QueryResponseAlternative23 | QueryResponseAlternative24 | QueryResponseAlternative25 | QueryResponseAlternative26 | QueryResponseAlternative27 | QueryResponseAlternative28 | QueryResponseAlternative29 | QueryResponseAlternative30 | QueryResponseAlternative31 | QueryResponseAlternative32 | QueryResponseAlternative33 | QueryResponseAlternative34 | QueryResponseAlternative35 | QueryResponseAlternative36 | QueryResponseAlternative37 | QueryResponseAlternative38 | unknown | QueryResponseAlternative39 | QueryResponseAlternative40 | QueryResponseAlternative41 | QueryResponseAlternative42 | QueryResponseAlternative43 | QueryResponseAlternative44 | QueryResponseAlternative45 | QueryResponseAlternative46 | QueryResponseAlternative47 | QueryResponseAlternative48 | QueryResponseAlternative49 | QueryResponseAlternative50 | QueryResponseAlternative51 | QueryResponseAlternative52 | QueryResponseAlternative53 | QueryResponseAlternative54 | QueryResponseAlternative55 | QueryResponseAlternative57 | QueryResponseAlternative58 | QueryResponseAlternative59 | QueryResponseAlternative60 | QueryResponseAlternative62 | QueryResponseAlternative63 | QueryResponseAlternative64 | QueryResponseAlternative66 | QueryResponseAlternative67 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative72 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative78 | QueryResponseAlternative79 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative82 | QueryResponseAlternative83 | QueryResponseAlternative84 | QueryResponseAlternative85 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative88 | QueryResponseAlternative89 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101 | QueryResponseAlternative102 | QueryResponseAlternative103 | QueryResponseAlternative104 | QueryResponseAlternative105 | QueryResponseAlternative106 | QueryResponseAlternative107 | QueryResponseAlternative108 | QueryResponseAlternative109 | QueryResponseAlternative110 | QueryResponseAlternative111;+ export type QueryResponseAlternative = { [key: string]: unknown } | QueryResponseAlternative1 | QueryResponseAlternative2 | QueryResponseAlternative3 | QueryResponseAlternative4 | QueryResponseAlternative5 | QueryResponseAlternative6 | QueryResponseAlternative7 | QueryResponseAlternative8 | QueryResponseAlternative9 | QueryResponseAlternative10 | QueryResponseAlternative11 | QueryResponseAlternative14 | QueryResponseAlternative15 | QueryResponseAlternative16 | QueryResponseAlternative17 | QueryResponseAlternative18 | QueryResponseAlternative19 | QueryResponseAlternative20 | QueryResponseAlternative21 | QueryResponseAlternative22 | QueryResponseAlternative23 | QueryResponseAlternative24 | QueryResponseAlternative25 | QueryResponseAlternative26 | QueryResponseAlternative27 | QueryResponseAlternative28 | QueryResponseAlternative29 | QueryResponseAlternative30 | QueryResponseAlternative31 | QueryResponseAlternative32 | QueryResponseAlternative33 | QueryResponseAlternative34 | QueryResponseAlternative35 | QueryResponseAlternative36 | QueryResponseAlternative37 | QueryResponseAlternative38 | unknown | QueryResponseAlternative39 | QueryResponseAlternative40 | QueryResponseAlternative41 | QueryResponseAlternative42 | QueryResponseAlternative43 | QueryResponseAlternative44 | QueryResponseAlternative45 | QueryResponseAlternative46 | QueryResponseAlternative47 | QueryResponseAlternative48 | QueryResponseAlternative49 | QueryResponseAlternative50 | QueryResponseAlternative51 | QueryResponseAlternative52 | QueryResponseAlternative53 | QueryResponseAlternative54 | QueryResponseAlternative55 | QueryResponseAlternative57 | QueryResponseAlternative58 | QueryResponseAlternative59 | QueryResponseAlternative60 | QueryResponseAlternative62 | QueryResponseAlternative63 | QueryResponseAlternative64 | QueryResponseAlternative66 | QueryResponseAlternative67 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative72 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative78 | QueryResponseAlternative79 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative82 | QueryResponseAlternative83 | QueryResponseAlternative84 | QueryResponseAlternative85 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative88 | QueryResponseAlternative89 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101 | QueryResponseAlternative102 | QueryResponseAlternative103 | QueryResponseAlternative104 | QueryResponseAlternative105 | QueryResponseAlternative106 | QueryResponseAlternative107 | QueryResponseAlternative108 | QueryResponseAlternative109 | QueryResponseAlternative110 | QueryResponseAlternative111 | QueryResponseAlternative112;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 | RevenueExampleEventsQuery | RevenueExampleDataWarehouseTablesQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | RevenueAnalyticsGrossRevenueQuery | RevenueAnalyticsMetricsQuery | RevenueAnalyticsMRRQuery | RevenueAnalyticsOverviewQuery | RevenueAnalyticsTopCustomersQuery | 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 | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | 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 | RevenueExampleEventsQuery | RevenueExampleDataWarehouseTablesQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | RevenueAnalyticsGrossRevenueQuery | RevenueAnalyticsMetricsQuery | RevenueAnalyticsMRRQuery | RevenueAnalyticsOverviewQuery | RevenueAnalyticsTopCustomersQuery | 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 | 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 | RevenueExampleEventsQuery | RevenueExampleDataWarehouseTablesQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | RevenueAnalyticsGrossRevenueQuery | RevenueAnalyticsMetricsQuery | RevenueAnalyticsMRRQuery | RevenueAnalyticsOverviewQuery | RevenueAnalyticsTopCustomersQuery | 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 | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | 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 | RevenueExampleEventsQuery | RevenueExampleDataWarehouseTablesQuery | ErrorTrackingQuery | ErrorTrackingSimilarIssuesQuery | ErrorTrackingBreakdownsQuery | ErrorTrackingIssueCorrelationQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | ExperimentQuery | ExperimentExposureQuery | DocumentSimilarityQuery | WebOverviewQuery | WebStatsTableQuery | WebExternalClicksTableQuery | WebGoalsQuery | WebVitalsQuery | WebVitalsPathBreakdownQuery | WebPageURLSearchQuery | WebAnalyticsExternalSummaryQuery | WebNotableChangesQuery | RevenueAnalyticsGrossRevenueQuery | RevenueAnalyticsMetricsQuery | RevenueAnalyticsMRRQuery | RevenueAnalyticsOverviewQuery | RevenueAnalyticsTopCustomersQuery | 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 | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolFailureOccurrencesQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolQualityRowsQuery | MCPToolQualityDailyStatsQuery | MCPToolCategoryCountsQuery | MCPToolCategoriesQuery | MCPToolDescriptionsQuery | MCPToolSampleIntentsQuery | MCPToolNeighborsQuery | PropertyValuesQuery;}export interface QuotaResourceLimit {diff --git a/services/mcp/src/tools/generated/mcp_analytics.ts b/services/mcp/src/tools/generated/mcp_analytics.tsindex ed580f0f9803..5134c92609f0 100644--- a/services/mcp/src/tools/generated/mcp_analytics.ts+++ b/services/mcp/src/tools/generated/mcp_analytics.ts@@ -566,6 +566,21 @@ const MCPToolFailuresQuery = z.object({.describe('The effective tool name to scope to (matched against the single-exec-resolved tool name).'),})+const MCPToolFailureOccurrencesQuery = z.object({+ dateRange: DateRange.optional(),+ errorStatus: z+ .string()+ .describe('When set, only events with this HTTP status match; when unset, only events without a status match.')+ .optional(),+ errorType: z+ .string()+ .describe('Raw $mcp_error_type bucket; "unknown" selects errored events without an error type.'),+ kind: z.literal('MCPToolFailureOccurrencesQuery').default('MCPToolFailureOccurrencesQuery'),+ toolName: z+ .string()+ .describe('The effective tool name to scope to (matched against the single-exec-resolved tool name).'),+})+const MCPToolTopUsersQuery = z.object({dateRange: DateRange.optional(),kind: z.literal('MCPToolTopUsersQuery').default('MCPToolTopUsersQuery'),@@ -629,6 +644,11 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {schema: MCPToolFailuresQuery,kind: 'MCPToolFailuresQuery',}),+ 'query-mcp-tool-failure-occurrences': createQueryWrapper({+ name: 'query-mcp-tool-failure-occurrences',+ schema: MCPToolFailureOccurrencesQuery,+ kind: 'MCPToolFailureOccurrencesQuery',+ }),'query-mcp-tool-top-users': createQueryWrapper({name: 'query-mcp-tool-top-users',schema: MCPToolTopUsersQuery,