Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(mcp-analytics): add tool stats, daily-stats and descriptions runners (#66087)

Paul D'Ambrad979158f3719
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 938ceff0dbb8..71f17e5d024b 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -921,6 +921,15 @@
},
{
"$ref": "#/definitions/MCPToolFailuresQuery"
+ },
+ {
+ "$ref": "#/definitions/MCPToolStatsQuery"
+ },
+ {
+ "$ref": "#/definitions/MCPToolDailyStatsQuery"
+ },
+ {
+ "$ref": "#/definitions/MCPToolDescriptionsQuery"
}
]
},
@@ -7879,6 +7888,178 @@
],
"type": "object"
},
+ "CachedMCPToolDailyStatsQueryResponse": {
+ "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/MCPToolDailyStatItem"
+ },
+ "type": "array"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "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.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ "type": "array"
+ }
+ },
+ "required": [
+ "cache_key",
+ "is_cached",
+ "last_refresh",
+ "next_allowed_client_refresh",
+ "results",
+ "timezone"
+ ],
+ "type": "object"
+ },
+ "CachedMCPToolDescriptionsQueryResponse": {
+ "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/MCPToolDescriptionItem"
+ },
+ "type": "array"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "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.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ "type": "array"
+ }
+ },
+ "required": [
+ "cache_key",
+ "is_cached",
+ "last_refresh",
+ "next_allowed_client_refresh",
+ "results",
+ "timezone"
+ ],
+ "type": "object"
+ },
"CachedMCPToolFailuresQueryResponse": {
"additionalProperties": false,
"properties": {
@@ -7965,6 +8146,93 @@
],
"type": "object"
},
+ "CachedMCPToolStatsQueryResponse": {
+ "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": {
+ "description": "Zero or one row; empty when the tool had no calls in the window.",
+ "items": {
+ "$ref": "#/definitions/MCPToolStatsItem"
+ },
+ "type": "array"
+ },
+ "timezone": {
+ "type": "string"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "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.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ "type": "array"
+ }
+ },
+ "required": [
+ "cache_key",
+ "is_cached",
+ "last_refresh",
+ "next_allowed_client_refresh",
+ "results",
+ "timezone"
+ ],
+ "type": "object"
+ },
"CachedMCPToolTopUsersQueryResponse": {
"additionalProperties": false,
"properties": {
@@ -26931,7 +27199,218 @@
},
"results": {
"items": {
- "$ref": "#/definitions/MCPHarnessBreakdownItem"
+ "$ref": "#/definitions/MCPHarnessBreakdownItem"
+ },
+ "type": "array"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "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.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["results"],
+ "type": "object"
+ },
+ "MCPToolDailyStatItem": {
+ "additionalProperties": false,
+ "description": "One day of activity for a single MCP tool.",
+ "properties": {
+ "calls": {
+ "$ref": "#/definitions/integer"
+ },
+ "day": {
+ "type": "string"
+ },
+ "errors": {
+ "$ref": "#/definitions/integer"
+ },
+ "p50": {
+ "type": "number"
+ },
+ "p95": {
+ "type": "number"
+ },
+ "sessions": {
+ "$ref": "#/definitions/integer"
+ },
+ "users": {
+ "$ref": "#/definitions/integer"
+ }
+ },
+ "required": ["day", "calls", "errors", "p50", "p95", "users", "sessions"],
+ "type": "object"
+ },
+ "MCPToolDailyStatsQuery": {
+ "additionalProperties": false,
+ "description": "Per-day activity series for a single MCP tool over the last 30 days.",
+ "properties": {
+ "dateRange": {
+ "$ref": "#/definitions/DateRange"
+ },
+ "kind": {
+ "const": "MCPToolDailyStatsQuery",
+ "type": "string"
+ },
+ "modifiers": {
+ "$ref": "#/definitions/HogQLQueryModifiers",
+ "description": "Modifiers used when performing the query"
+ },
+ "response": {
+ "$ref": "#/definitions/MCPToolDailyStatsQueryResponse"
+ },
+ "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": ["kind", "toolName"],
+ "type": "object"
+ },
+ "MCPToolDailyStatsQueryResponse": {
+ "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/MCPToolDailyStatItem"
+ },
+ "type": "array"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "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.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["results"],
+ "type": "object"
+ },
+ "MCPToolDescriptionItem": {
+ "additionalProperties": false,
+ "description": "One distinct description seen for a single MCP tool, with the last time it was reported.",
+ "properties": {
+ "description": {
+ "type": "string"
+ },
+ "last_seen": {
+ "type": "string"
+ }
+ },
+ "required": ["description", "last_seen"],
+ "type": "object"
+ },
+ "MCPToolDescriptionsQuery": {
+ "additionalProperties": false,
+ "description": "Distinct descriptions reported for a single MCP tool over the last 30 days, most recent first.",
+ "properties": {
+ "dateRange": {
+ "$ref": "#/definitions/DateRange"
+ },
+ "kind": {
+ "const": "MCPToolDescriptionsQuery",
+ "type": "string"
+ },
+ "modifiers": {
+ "$ref": "#/definitions/HogQLQueryModifiers",
+ "description": "Modifiers used when performing the query"
+ },
+ "response": {
+ "$ref": "#/definitions/MCPToolDescriptionsQueryResponse"
+ },
+ "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": ["kind", "toolName"],
+ "type": "object"
+ },
+ "MCPToolDescriptionsQueryResponse": {
+ "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/MCPToolDescriptionItem"
},
"type": "array"
},
@@ -27061,6 +27540,121 @@
"required": ["results"],
"type": "object"
},
+ "MCPToolStatsItem": {
+ "additionalProperties": false,
+ "description": "Summary scalars for a single MCP tool: activity, latency, reach, and intent coverage.",
+ "properties": {
+ "calls": {
+ "$ref": "#/definitions/integer"
+ },
+ "conversations": {
+ "$ref": "#/definitions/integer"
+ },
+ "errors": {
+ "$ref": "#/definitions/integer"
+ },
+ "p50_ms": {
+ "type": ["number", "null"]
+ },
+ "p95_ms": {
+ "type": ["number", "null"]
+ },
+ "users": {
+ "$ref": "#/definitions/integer"
+ },
+ "with_intent": {
+ "$ref": "#/definitions/integer",
+ "description": "Calls carrying a non-empty intent payload; the coverage denominator is `calls`."
+ }
+ },
+ "required": ["calls", "errors", "p50_ms", "p95_ms", "users", "conversations", "with_intent"],
+ "type": "object"
+ },
+ "MCPToolStatsQuery": {
+ "additionalProperties": false,
+ "description": "Summary scalars and intent coverage for a single MCP tool over the last 7 days.",
+ "properties": {
+ "dateRange": {
+ "$ref": "#/definitions/DateRange"
+ },
+ "kind": {
+ "const": "MCPToolStatsQuery",
+ "type": "string"
+ },
+ "modifiers": {
+ "$ref": "#/definitions/HogQLQueryModifiers",
+ "description": "Modifiers used when performing the query"
+ },
+ "response": {
+ "$ref": "#/definitions/MCPToolStatsQueryResponse"
+ },
+ "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": ["kind", "toolName"],
+ "type": "object"
+ },
+ "MCPToolStatsQueryResponse": {
+ "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": {
+ "description": "Zero or one row; empty when the tool had no calls in the window.",
+ "items": {
+ "$ref": "#/definitions/MCPToolStatsItem"
+ },
+ "type": "array"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "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.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["results"],
+ "type": "object"
+ },
"MCPToolTopUserItem": {
"additionalProperties": false,
"description": "One row of the per-tool \"Top users\" table: a user and their activity on a tool.",
@@ -30185,6 +30779,9 @@
"MCPHarnessBreakdownQuery",
"MCPToolTopUsersQuery",
"MCPToolFailuresQuery",
+ "MCPToolStatsQuery",
+ "MCPToolDailyStatsQuery",
+ "MCPToolDescriptionsQuery",
"PropertyValuesQuery"
],
"type": "string"
@@ -37719,6 +38316,160 @@
"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": {
+ "description": "Zero or one row; empty when the tool had no calls in the window.",
+ "items": {
+ "$ref": "#/definitions/MCPToolStatsItem"
+ },
+ "type": "array"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "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.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ "type": "array"
+ }
+ },
+ "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/MCPToolDailyStatItem"
+ },
+ "type": "array"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "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.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ "type": "array"
+ }
+ },
+ "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/MCPToolDescriptionItem"
+ },
+ "type": "array"
+ },
+ "timings": {
+ "description": "Measured timings for different parts of the query generation process",
+ "items": {
+ "$ref": "#/definitions/QueryTiming"
+ },
+ "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.",
+ "items": {
+ "$ref": "#/definitions/DataWarehouseSyncWarning"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["results"],
+ "type": "object"
+ },
{
"additionalProperties": false,
"properties": {
@@ -38023,6 +38774,15 @@
{
"$ref": "#/definitions/MCPToolFailuresQuery"
},
+ {
+ "$ref": "#/definitions/MCPToolStatsQuery"
+ },
+ {
+ "$ref": "#/definitions/MCPToolDailyStatsQuery"
+ },
+ {
+ "$ref": "#/definitions/MCPToolDescriptionsQuery"
+ },
{
"$ref": "#/definitions/PropertyValuesQuery"
}
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index d7e794ab8061..b34e43bd2ab5 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -196,6 +196,9 @@ export enum NodeKind {
MCPHarnessBreakdownQuery = 'MCPHarnessBreakdownQuery',
MCPToolTopUsersQuery = 'MCPToolTopUsersQuery',
MCPToolFailuresQuery = 'MCPToolFailuresQuery',
+ MCPToolStatsQuery = 'MCPToolStatsQuery',
+ MCPToolDailyStatsQuery = 'MCPToolDailyStatsQuery',
+ MCPToolDescriptionsQuery = 'MCPToolDescriptionsQuery',
// Property values
PropertyValuesQuery = 'PropertyValuesQuery',
@@ -263,6 +266,9 @@ export type AnyDataNode =
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
/**
* @discriminator kind
@@ -377,6 +383,9 @@ export type QuerySchema =
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
// Property values
| PropertyValuesQuery
@@ -2606,6 +2615,78 @@ export interface MCPToolFailuresQuery extends DataNode<MCPToolFailuresQueryRespo
export type CachedMCPToolFailuresQueryResponse = CachedQueryResponse<MCPToolFailuresQueryResponse>
+/** Summary scalars for a single MCP tool: activity, latency, reach, and intent coverage. */
+export interface MCPToolStatsItem {
+ calls: integer
+ errors: integer
+ p50_ms: number | null
+ p95_ms: number | null
+ users: integer
+ conversations: integer
+ /** Calls carrying a non-empty intent payload; the coverage denominator is `calls`. */
+ with_intent: integer
+}
+
+export interface MCPToolStatsQueryResponse extends AnalyticsQueryResponseBase {
+ /** Zero or one row; empty when the tool had no calls in the window. */
+ results: MCPToolStatsItem[]
+}
+
+/** Summary scalars and intent coverage for a single MCP tool over the last 7 days. */
+export interface MCPToolStatsQuery extends DataNode<MCPToolStatsQueryResponse> {
+ kind: NodeKind.MCPToolStatsQuery
+ /** The effective tool name to scope to (matched against the single-exec-resolved tool name). */
+ toolName: string
+ dateRange?: DateRange
+}
+
+export type CachedMCPToolStatsQueryResponse = CachedQueryResponse<MCPToolStatsQueryResponse>
+
+/** One day of activity for a single MCP tool. */
+export interface MCPToolDailyStatItem {
+ day: string
+ calls: integer
+ errors: integer
+ p50: number
+ p95: number
+ users: integer
+ sessions: integer
+}
+
+export interface MCPToolDailyStatsQueryResponse extends AnalyticsQueryResponseBase {
+ results: MCPToolDailyStatItem[]
+}
+
+/** Per-day activity series for a single MCP tool over the last 30 days. */
+export interface MCPToolDailyStatsQuery extends DataNode<MCPToolDailyStatsQueryResponse> {
+ kind: NodeKind.MCPToolDailyStatsQuery
+ /** The effective tool name to scope to (matched against the single-exec-resolved tool name). */
+ toolName: string
+ dateRange?: DateRange
+}
+
+export type CachedMCPToolDailyStatsQueryResponse = CachedQueryResponse<MCPToolDailyStatsQueryResponse>
+
+/** One distinct description seen for a single MCP tool, with the last time it was reported. */
+export interface MCPToolDescriptionItem {
+ description: string
+ last_seen: string
+}
+
+export interface MCPToolDescriptionsQueryResponse extends AnalyticsQueryResponseBase {
+ results: MCPToolDescriptionItem[]
+}
+
+/** Distinct descriptions reported for a single MCP tool over the last 30 days, most recent first. */
+export interface MCPToolDescriptionsQuery extends DataNode<MCPToolDescriptionsQueryResponse> {
+ kind: NodeKind.MCPToolDescriptionsQuery
+ /** The effective tool name to scope to (matched against the single-exec-resolved tool name). */
+ toolName: string
+ dateRange?: DateRange
+}
+
+export type CachedMCPToolDescriptionsQueryResponse = CachedQueryResponse<MCPToolDescriptionsQueryResponse>
+
export enum WebStatsBreakdown {
Page = 'Page',
InitialPage = 'InitialPage',
diff --git a/frontend/src/scenes/saved-insights/SavedInsights.tsx b/frontend/src/scenes/saved-insights/SavedInsights.tsx
index 94c9fb0762cf..6c1d19f6aaea 100644
--- a/frontend/src/scenes/saved-insights/SavedInsights.tsx
+++ b/frontend/src/scenes/saved-insights/SavedInsights.tsx
@@ -633,6 +633,24 @@ export const QUERY_TYPES_METADATA: Record<NodeKind, InsightTypeMetadata> = {
icon: IconPieChart,
inMenu: false,
},
+ [NodeKind.MCPToolStatsQuery]: {
+ name: 'MCP tool stats',
+ description: 'Summary stats for a single MCP tool.',
+ icon: IconPieChart,
+ inMenu: false,
+ },
+ [NodeKind.MCPToolDailyStatsQuery]: {
+ name: 'MCP tool daily stats',
+ description: 'Per-day activity for a single MCP tool.',
+ icon: IconPieChart,
+ inMenu: false,
+ },
+ [NodeKind.MCPToolDescriptionsQuery]: {
+ name: 'MCP tool descriptions',
+ description: 'Reported descriptions for a single MCP tool.',
+ icon: IconPieChart,
+ inMenu: false,
+ },
[NodeKind.MCPToolTopUsersQuery]: {
name: 'MCP tool top users',
description: 'Top users of a single MCP tool.',
diff --git a/posthog/clickhouse/query_tagging.py b/posthog/clickhouse/query_tagging.py
index 47ba7a5ce7e9..04ddfa0b3923 100644
--- a/posthog/clickhouse/query_tagging.py
+++ b/posthog/clickhouse/query_tagging.py
@@ -263,7 +263,12 @@ def kind_fallback_tags(kind: NodeKind) -> FallbackTags | None:
):
return {"product": Product.MARKETING_ANALYTICS}
case (
- NodeKind.MCP_HARNESS_BREAKDOWN_QUERY | NodeKind.MCP_TOOL_TOP_USERS_QUERY | NodeKind.MCP_TOOL_FAILURES_QUERY
+ NodeKind.MCP_HARNESS_BREAKDOWN_QUERY
+ | NodeKind.MCP_TOOL_TOP_USERS_QUERY
+ | NodeKind.MCP_TOOL_FAILURES_QUERY
+ | NodeKind.MCP_TOOL_STATS_QUERY
+ | NodeKind.MCP_TOOL_DAILY_STATS_QUERY
+ | NodeKind.MCP_TOOL_DESCRIPTIONS_QUERY
):
return {"product": Product.MCP_ANALYTICS}
case (
diff --git a/posthog/hogql_queries/query_runner.py b/posthog/hogql_queries/query_runner.py
index 97f1708bf2f8..79bef8331e5f 100644
--- a/posthog/hogql_queries/query_runner.py
+++ b/posthog/hogql_queries/query_runner.py
@@ -44,7 +44,10 @@ from posthog.schema import (
MarketingAnalyticsAggregatedQuery,
MarketingAnalyticsTableQuery,
MCPHarnessBreakdownQuery,
+ MCPToolDailyStatsQuery,
+ MCPToolDescriptionsQuery,
MCPToolFailuresQuery,
+ MCPToolStatsQuery,
MCPToolTopUsersQuery,
NodeKind,
PathsQuery,
@@ -315,6 +318,9 @@ RunnableQueryNode = Union[
MCPHarnessBreakdownQuery,
MCPToolTopUsersQuery,
MCPToolFailuresQuery,
+ MCPToolStatsQuery,
+ MCPToolDailyStatsQuery,
+ MCPToolDescriptionsQuery,
]
@@ -977,6 +983,39 @@ def get_query_runner(
modifiers=modifiers,
user=user,
)
+ if kind == "MCPToolStatsQuery":
+ from products.mcp_analytics.backend.facade.queries import MCPToolStatsQueryRunner
+
+ return MCPToolStatsQueryRunner(
+ query=cast(MCPToolStatsQuery | dict[str, Any], query),
+ team=team,
+ timings=timings,
+ limit_context=limit_context,
+ modifiers=modifiers,
+ user=user,
+ )
+ if kind == "MCPToolDailyStatsQuery":
+ from products.mcp_analytics.backend.facade.queries import MCPToolDailyStatsQueryRunner
+
+ return MCPToolDailyStatsQueryRunner(
+ query=cast(MCPToolDailyStatsQuery | dict[str, Any], query),
+ team=team,
+ timings=timings,
+ limit_context=limit_context,
+ modifiers=modifiers,
+ user=user,
+ )
+ if kind == "MCPToolDescriptionsQuery":
+ from products.mcp_analytics.backend.facade.queries import MCPToolDescriptionsQueryRunner
+
+ return MCPToolDescriptionsQueryRunner(
+ query=cast(MCPToolDescriptionsQuery | dict[str, Any], query),
+ team=team,
+ timings=timings,
+ limit_context=limit_context,
+ modifiers=modifiers,
+ user=user,
+ )
if kind == "TraceQuery":
from .ai.trace_query_runner import TraceQueryRunner
diff --git a/posthog/schema.py b/posthog/schema.py
index 355d159c2071..002a4df263df 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -1675,6 +1675,14 @@ class LogsAlertStateChangeSignalExtra(BaseModel):
window_minutes: float
+class MCPToolDescriptionItem(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str
+ last_seen: str
+
+
class MarkdownBlock(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -5755,6 +5763,19 @@ class MCPHarnessBreakdownItem(BaseModel):
total_calls: int
+class MCPToolDailyStatItem(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ calls: int
+ day: str
+ errors: int
+ p50: float
+ p95: float
+ sessions: int
+ users: int
+
+
class MCPToolFailureItem(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -5768,6 +5789,22 @@ class MCPToolFailureItem(BaseModel):
occurrences: int
+class MCPToolStatsItem(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ calls: int
+ conversations: int
+ errors: int
+ p50_ms: float | None = None
+ p95_ms: float | None = None
+ users: int
+ with_intent: int = Field(
+ ...,
+ description=("Calls carrying a non-empty intent payload; the coverage denominator is `calls`."),
+ )
+
+
class MCPToolTopUserItem(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -10920,6 +10957,110 @@ class CachedMCPHarnessBreakdownQueryResponse(BaseModel):
)
+class CachedMCPToolDailyStatsQueryResponse(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[MCPToolDailyStatItem]
+ timezone: str
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ warnings: list[DataWarehouseSyncWarning] | 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."
+ ),
+ )
+
+
+class CachedMCPToolDescriptionsQueryResponse(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[MCPToolDescriptionItem]
+ timezone: str
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ warnings: list[DataWarehouseSyncWarning] | 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."
+ ),
+ )
+
+
class CachedMCPToolFailuresQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -10972,6 +11113,61 @@ class CachedMCPToolFailuresQueryResponse(BaseModel):
)
+class CachedMCPToolStatsQueryResponse(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[MCPToolStatsItem] = Field(
+ ...,
+ description="Zero or one row; empty when the tool had no calls in the window.",
+ )
+ timezone: str
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ warnings: list[DataWarehouseSyncWarning] | 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."
+ ),
+ )
+
+
class CachedMCPToolTopUsersQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -16504,6 +16700,88 @@ class MCPHarnessBreakdownQueryResponse(BaseModel):
)
+class MCPToolDailyStatsQueryResponse(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[MCPToolDailyStatItem]
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ warnings: list[DataWarehouseSyncWarning] | 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."
+ ),
+ )
+
+
+class MCPToolDescriptionsQueryResponse(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[MCPToolDescriptionItem]
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ warnings: list[DataWarehouseSyncWarning] | 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."
+ ),
+ )
+
+
class MCPToolFailuresQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -16545,6 +16823,50 @@ class MCPToolFailuresQueryResponse(BaseModel):
)
+class MCPToolStatsQueryResponse(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[MCPToolStatsItem] = Field(
+ ...,
+ description="Zero or one row; empty when the tool had no calls in the window.",
+ )
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ warnings: list[DataWarehouseSyncWarning] | 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."
+ ),
+ )
+
+
class MCPToolTopUsersQueryResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -20458,6 +20780,132 @@ class QueryResponseAlternative98(BaseModel):
class QueryResponseAlternative99(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[MCPToolStatsItem] = Field(
+ ...,
+ description="Zero or one row; empty when the tool had no calls in the window.",
+ )
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ warnings: list[DataWarehouseSyncWarning] | 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."
+ ),
+ )
+
+
+class QueryResponseAlternative100(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[MCPToolDailyStatItem]
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ warnings: list[DataWarehouseSyncWarning] | 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."
+ ),
+ )
+
+
+class QueryResponseAlternative101(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[MCPToolDescriptionItem]
+ timings: list[QueryTiming] | None = Field(
+ default=None,
+ description=("Measured timings for different parts of the query generation process"),
+ )
+ warnings: list[DataWarehouseSyncWarning] | 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."
+ ),
+ )
+
+
+class QueryResponseAlternative102(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
@@ -22820,6 +23268,38 @@ class MCPHarnessBreakdownQuery(BaseModel):
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+class MCPToolDailyStatsQuery(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ dateRange: DateRange | None = None
+ kind: Literal["MCPToolDailyStatsQuery"] = "MCPToolDailyStatsQuery"
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ response: MCPToolDailyStatsQueryResponse | 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 MCPToolDescriptionsQuery(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ dateRange: DateRange | None = None
+ kind: Literal["MCPToolDescriptionsQuery"] = "MCPToolDescriptionsQuery"
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ response: MCPToolDescriptionsQueryResponse | 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",
@@ -22833,6 +23313,22 @@ class MCPToolFailuresQuery(BaseModel):
version: float | None = Field(default=None, description="version of the node, used for schema migrations")
+class MCPToolStatsQuery(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ dateRange: DateRange | None = None
+ kind: Literal["MCPToolStatsQuery"] = "MCPToolStatsQuery"
+ modifiers: HogQLQueryModifiers | None = Field(default=None, description="Modifiers used when performing the query")
+ response: MCPToolStatsQueryResponse | 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 MCPToolTopUsersQuery(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -25491,6 +25987,9 @@ class QueryResponseAlternative(
| QueryResponseAlternative97
| QueryResponseAlternative98
| QueryResponseAlternative99
+ | QueryResponseAlternative100
+ | QueryResponseAlternative101
+ | QueryResponseAlternative102
]
):
root: (
@@ -25589,6 +26088,9 @@ class QueryResponseAlternative(
| QueryResponseAlternative97
| QueryResponseAlternative98
| QueryResponseAlternative99
+ | QueryResponseAlternative100
+ | QueryResponseAlternative101
+ | QueryResponseAlternative102
)
@@ -26636,6 +27138,9 @@ class HogQLAutocomplete(BaseModel):
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
| None
) = Field(default=None, description="Query in whose context to validate.")
startPosition: int = Field(..., description="Start position of the editor word")
@@ -26728,6 +27233,9 @@ class HogQLMetadata(BaseModel):
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
| None
) = Field(
default=None,
@@ -26855,6 +27363,9 @@ class MaxInsightContext(BaseModel):
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
| PropertyValuesQuery
) = Field(..., discriminator="kind")
type: Literal["insight"] = "insight"
@@ -26979,6 +27490,9 @@ class QueryRequest(BaseModel):
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
| PropertyValuesQuery
) = Field(
...,
@@ -27095,6 +27609,9 @@ class QuerySchemaRoot(
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
| PropertyValuesQuery
]
):
@@ -27181,6 +27698,9 @@ class QuerySchemaRoot(
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
| PropertyValuesQuery
) = Field(..., discriminator="kind")
@@ -27272,6 +27792,9 @@ class QueryUpgradeRequest(BaseModel):
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
| PropertyValuesQuery
) = Field(..., discriminator="kind")
@@ -27363,6 +27886,9 @@ class QueryUpgradeResponse(BaseModel):
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
| PropertyValuesQuery
) = Field(..., discriminator="kind")
@@ -27631,6 +28157,9 @@ class VisualizationArtifactContent(BaseModel):
| MCPHarnessBreakdownQuery
| MCPToolTopUsersQuery
| MCPToolFailuresQuery
+ | MCPToolStatsQuery
+ | MCPToolDailyStatsQuery
+ | MCPToolDescriptionsQuery
| PropertyValuesQuery
)
diff --git a/posthog/schema_enums.py b/posthog/schema_enums.py
index 2c2e18d3e83d..dd5e060c700f 100644
--- a/posthog/schema_enums.py
+++ b/posthog/schema_enums.py
@@ -2568,6 +2568,9 @@ class NodeKind(StrEnum):
MCP_HARNESS_BREAKDOWN_QUERY = "MCPHarnessBreakdownQuery"
MCP_TOOL_TOP_USERS_QUERY = "MCPToolTopUsersQuery"
MCP_TOOL_FAILURES_QUERY = "MCPToolFailuresQuery"
+ MCP_TOOL_STATS_QUERY = "MCPToolStatsQuery"
+ MCP_TOOL_DAILY_STATS_QUERY = "MCPToolDailyStatsQuery"
+ MCP_TOOL_DESCRIPTIONS_QUERY = "MCPToolDescriptionsQuery"
PROPERTY_VALUES_QUERY = "PropertyValuesQuery"
diff --git a/products/mcp_analytics/backend/facade/queries.py b/products/mcp_analytics/backend/facade/queries.py
index fae06198df4f..44bf395be395 100644
--- a/products/mcp_analytics/backend/facade/queries.py
+++ b/products/mcp_analytics/backend/facade/queries.py
@@ -7,12 +7,18 @@ mcp_analytics is tach-isolated to expose only `backend.facade.*`, so core's
from products.mcp_analytics.backend.hogql_queries.harness_breakdown import MCPHarnessBreakdownQueryRunner
from products.mcp_analytics.backend.hogql_queries.tool_tables import (
+ MCPToolDailyStatsQueryRunner,
+ MCPToolDescriptionsQueryRunner,
MCPToolFailuresQueryRunner,
+ MCPToolStatsQueryRunner,
MCPToolTopUsersQueryRunner,
)
__all__ = [
"MCPHarnessBreakdownQueryRunner",
+ "MCPToolDailyStatsQueryRunner",
+ "MCPToolDescriptionsQueryRunner",
"MCPToolFailuresQueryRunner",
+ "MCPToolStatsQueryRunner",
"MCPToolTopUsersQueryRunner",
]
diff --git a/products/mcp_analytics/backend/hogql_queries/tool_tables.py b/products/mcp_analytics/backend/hogql_queries/tool_tables.py
index 6858a6fbab02..5c3ca1507db7 100644
--- a/products/mcp_analytics/backend/hogql_queries/tool_tables.py
+++ b/products/mcp_analytics/backend/hogql_queries/tool_tables.py
@@ -5,15 +5,28 @@ Both resolve the client harness to a customer label server-side via `mcp_harness
the dashboard donut — the frontend only maps a resolved label to its logo.
"""
+import json
from functools import cached_property
from typing import TYPE_CHECKING
from posthog.schema import (
+ CachedMCPToolDailyStatsQueryResponse,
+ CachedMCPToolDescriptionsQueryResponse,
CachedMCPToolFailuresQueryResponse,
+ CachedMCPToolStatsQueryResponse,
CachedMCPToolTopUsersQueryResponse,
+ MCPToolDailyStatItem,
+ MCPToolDailyStatsQuery,
+ MCPToolDailyStatsQueryResponse,
+ MCPToolDescriptionItem,
+ MCPToolDescriptionsQuery,
+ MCPToolDescriptionsQueryResponse,
MCPToolFailureItem,
MCPToolFailuresQuery,
MCPToolFailuresQueryResponse,
+ MCPToolStatsItem,
+ MCPToolStatsQuery,
+ MCPToolStatsQueryResponse,
MCPToolTopUserItem,
MCPToolTopUsersQuery,
MCPToolTopUsersQueryResponse,
@@ -41,6 +54,14 @@ _NEW_SDK_SOURCE = "posthog_mcp_analytics"
_EFFECTIVE_TOOL = (
"coalesce(nullIf(toString(properties.$mcp_exec_tool_call_name), ''), toString(properties.$mcp_tool_name))"
)
+# The description of the *effective* tool: for single-exec calls the inner tool's
+# $mcp_exec_tool_call_description, else the directly-registered $mcp_tool_description.
+# Without this, an inner tool's Descriptions table would show the exec wrapper's text
+# (another tool's description) — a tool-level disclosure.
+_EFFECTIVE_DESCRIPTION = (
+ "coalesce(nullIf(toString(properties.$mcp_exec_tool_call_description), ''), "
+ "toString(properties.$mcp_tool_description))"
+)
# A per-row distinct-and-sorted list of resolved harness labels, collected from the
# token computed in the inner subquery. groupArray evaluates the label per row, so the
@@ -48,6 +69,32 @@ _EFFECTIVE_TOOL = (
_HARNESS_LABELS_AGG = f"arraySort(arrayDistinct(groupArray({mcp_harness.harness_label_sql('h')})))"
+def _display_properties(*, email: str, name: str) -> str:
+ """JSON of only the person fields the Top-users cell renders, omitting blanks."""
+ return json.dumps({k: v for k, v in (("email", email), ("name", name)) if v})
+
+
+def _tool_call_where(tool: str, date_range: QueryDateRange, *, extra: list[ast.Expr] | None = None) -> ast.Expr:
+ """WHERE for new-SDK $mcp_tool_call events scoped to one effective tool and window.
+
+ `tool` is bound as an ast.Constant, never interpolated. `extra` appends
+ query-specific predicates (e.g. notEmpty(description)).
+ """
+ exprs: list[ast.Expr] = [
+ parse_expr("event = {event}", placeholders={"event": ast.Constant(value=MCP_TOOL_CALL_EVENT)}),
+ parse_expr("timestamp >= {date_from}", placeholders={"date_from": date_range.date_from_as_hogql()}),
+ parse_expr("timestamp <= {date_to}", placeholders={"date_to": date_range.date_to_as_hogql()}),
+ parse_expr(
+ "{_EFFECTIVE_TOOL} = {tool}",
+ placeholders={"_EFFECTIVE_TOOL": parse_expr(_EFFECTIVE_TOOL), "tool": ast.Constant(value=tool)},
+ ),
+ parse_expr("properties.$mcp_source = {source}", placeholders={"source": ast.Constant(value=_NEW_SDK_SOURCE)}),
+ ]
+ if extra:
+ exprs.extend(extra)
+ return ast.And(exprs=exprs)
+
+
class MCPToolTopUsersQueryRunner(AnalyticsQueryRunner[MCPToolTopUsersQueryResponse]):
query: MCPToolTopUsersQuery
cached_response: CachedMCPToolTopUsersQueryResponse
@@ -60,45 +107,27 @@ class MCPToolTopUsersQueryRunner(AnalyticsQueryRunner[MCPToolTopUsersQueryRespon
return mcp_query_date_range(self.team, self.query.dateRange)
def _where(self) -> ast.Expr:
- return ast.And(
- exprs=[
- parse_expr("event = {event}", placeholders={"event": ast.Constant(value=MCP_TOOL_CALL_EVENT)}),
- parse_expr(
- "timestamp >= {date_from}", placeholders={"date_from": self.query_date_range.date_from_as_hogql()}
- ),
- parse_expr(
- "timestamp <= {date_to}", placeholders={"date_to": self.query_date_range.date_to_as_hogql()}
- ),
- parse_expr(
- "{effective_tool} = {tool}",
- placeholders={
- "effective_tool": parse_expr(_EFFECTIVE_TOOL),
- "tool": ast.Constant(value=self.query.toolName),
- },
- ),
- parse_expr(
- "properties.$mcp_source = {source}", placeholders={"source": ast.Constant(value=_NEW_SDK_SOURCE)}
- ),
- ]
- )
+ return _tool_call_where(self.query.toolName, self.query_date_range)
def to_query(self) -> ast.SelectQuery | ast.SelectSetQuery:
return parse_select(
"""
SELECT
distinct_id,
- argMax(person_properties, timestamp) AS person_properties,
+ argMax(person_email, timestamp) AS email,
+ argMax(person_name, timestamp) AS name,
count() AS calls,
countIf(is_error) AS errors,
round(countIf(is_error) * 100.0 / count(), 1) AS error_rate_pct,
- {labels_agg} AS harnesses,
+ {_HARNESS_LABELS_AGG} AS harnesses,
max(timestamp) AS last_seen
FROM (
SELECT
distinct_id,
timestamp,
toBool(properties.$mcp_is_error) AS is_error,
- toString(person.properties) AS person_properties,
+ toString(person.properties.email) AS person_email,
+ toString(person.properties.name) AS person_name,
{token} AS h
FROM events
WHERE {where}
@@ -108,7 +137,7 @@ class MCPToolTopUsersQueryRunner(AnalyticsQueryRunner[MCPToolTopUsersQueryRespon
LIMIT 5
""",
placeholders={
- "labels_agg": parse_expr(_HARNESS_LABELS_AGG),
+ "_HARNESS_LABELS_AGG": parse_expr(_HARNESS_LABELS_AGG),
"token": parse_expr(mcp_harness.HARNESS_TOKEN_SQL),
"where": self._where(),
},
@@ -133,12 +162,14 @@ class MCPToolTopUsersQueryRunner(AnalyticsQueryRunner[MCPToolTopUsersQueryRespon
results = [
MCPToolTopUserItem(
distinct_id=str(row[0]),
- person_properties=str(row[1] or ""),
- calls=int(row[2] or 0),
- errors=int(row[3] or 0),
- error_rate_pct=float(row[4] or 0),
- harnesses=[str(h) for h in (row[5] or [])],
- last_seen=str(row[6] or ""),
+ # Only the fields the Top-users cell renders (display name + email), not the
+ # whole person.properties blob — keeps the runner to least person-data exposure.
+ person_properties=_display_properties(email=str(row[1] or ""), name=str(row[2] or "")),
+ calls=int(row[3] or 0),
+ errors=int(row[4] or 0),
+ error_rate_pct=float(row[5] or 0),
+ harnesses=[str(h) for h in (row[6] or [])],
+ last_seen=str(row[7] or ""),
)
for row in (response.results or [])
]
@@ -188,7 +219,7 @@ class MCPToolFailuresQueryRunner(AnalyticsQueryRunner[MCPToolFailuresQueryRespon
message,
count() AS occurrences,
max(timestamp) AS last_seen,
- {labels_agg} AS harnesses
+ {_HARNESS_LABELS_AGG} AS harnesses
FROM (
SELECT
substring(toString(properties.$exception_message), 1, 200) AS message,
@@ -202,7 +233,7 @@ class MCPToolFailuresQueryRunner(AnalyticsQueryRunner[MCPToolFailuresQueryRespon
LIMIT 20
""",
placeholders={
- "labels_agg": parse_expr(_HARNESS_LABELS_AGG),
+ "_HARNESS_LABELS_AGG": parse_expr(_HARNESS_LABELS_AGG),
"token": parse_expr(mcp_harness.HARNESS_TOKEN_SQL),
"where": self._where(),
},
@@ -239,3 +270,216 @@ class MCPToolFailuresQueryRunner(AnalyticsQueryRunner[MCPToolFailuresQueryRespon
hogql=response.hogql,
modifiers=self.modifiers,
)
+
+
+_CONVERSATION_ID = "coalesce(nullIf(toString(properties.$mcp_session_id), ''), toString(properties.$session_id))"
+_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)))"
+
+
+class MCPToolStatsQueryRunner(AnalyticsQueryRunner[MCPToolStatsQueryResponse]):
+ query: MCPToolStatsQuery
+ cached_response: CachedMCPToolStatsQueryResponse
+
+ 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 to_query(self) -> ast.SelectQuery | ast.SelectSetQuery:
+ return parse_select(
+ """
+ SELECT
+ count() AS calls,
+ {_IS_ERROR} AS errors,
+ {_P50} AS p50_ms,
+ {_P95} AS p95_ms,
+ uniq(distinct_id) AS users,
+ uniq({_CONVERSATION_ID}) AS conversations,
+ countIf(notEmpty(toString(properties.$mcp_intent)) AND toString(properties.$mcp_intent) != '{}') AS with_intent
+ FROM events
+ WHERE {where}
+ """,
+ placeholders={
+ "_CONVERSATION_ID": parse_expr(_CONVERSATION_ID),
+ "_IS_ERROR": parse_expr(_IS_ERROR),
+ "_P50": parse_expr(_P50),
+ "_P95": parse_expr(_P95),
+ "where": _tool_call_where(self.query.toolName, self.query_date_range),
+ },
+ )
+
+ def _calculate(self) -> MCPToolStatsQueryResponse:
+ with tags_context(
+ product=Product.MCP_ANALYTICS,
+ feature=Feature.QUERY,
+ team_id=self.team.id,
+ name="mcp_tool_stats_query",
+ ):
+ response = execute_hogql_query(
+ query=self.to_query(),
+ team=self.team,
+ query_type="mcp_tool_stats_query",
+ timings=self.timings,
+ modifiers=self.modifiers,
+ limit_context=self.limit_context,
+ )
+
+ row = (response.results or [None])[0]
+ results = (
+ [
+ MCPToolStatsItem(
+ calls=int(row[0] or 0),
+ errors=int(row[1] or 0),
+ p50_ms=None if row[2] is None else float(row[2]),
+ p95_ms=None if row[3] is None else float(row[3]),
+ users=int(row[4] or 0),
+ conversations=int(row[5] or 0),
+ with_intent=int(row[6] or 0),
+ )
+ ]
+ if row and int(row[0] or 0) > 0
+ else []
+ )
+ return MCPToolStatsQueryResponse(
+ results=results,
+ timings=response.timings,
+ hogql=response.hogql,
+ modifiers=self.modifiers,
+ )
+
+
+class MCPToolDailyStatsQueryRunner(AnalyticsQueryRunner[MCPToolDailyStatsQueryResponse]):
+ query: MCPToolDailyStatsQuery
+ cached_response: CachedMCPToolDailyStatsQueryResponse
+
+ 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 to_query(self) -> ast.SelectQuery | ast.SelectSetQuery:
+ return parse_select(
+ """
+ SELECT
+ toString(toDate(timestamp)) AS day,
+ count() AS calls,
+ {_IS_ERROR} AS errors,
+ {_P50} AS p50,
+ {_P95} AS p95,
+ uniq(distinct_id) AS users,
+ uniq({_CONVERSATION_ID}) AS sessions
+ FROM events
+ WHERE {where}
+ GROUP BY day
+ ORDER BY day
+ """,
+ placeholders={
+ "_CONVERSATION_ID": parse_expr(_CONVERSATION_ID),
+ "_IS_ERROR": parse_expr(_IS_ERROR),
+ "_P50": parse_expr(_P50),
+ "_P95": parse_expr(_P95),
+ "where": _tool_call_where(self.query.toolName, self.query_date_range),
+ },
+ )
+
+ def _calculate(self) -> MCPToolDailyStatsQueryResponse:
+ with tags_context(
+ product=Product.MCP_ANALYTICS,
+ feature=Feature.QUERY,
+ team_id=self.team.id,
+ name="mcp_tool_daily_stats_query",
+ ):
+ response = execute_hogql_query(
+ query=self.to_query(),
+ team=self.team,
+ query_type="mcp_tool_daily_stats_query",
+ timings=self.timings,
+ modifiers=self.modifiers,
+ limit_context=self.limit_context,
+ )
+
+ results = [
+ MCPToolDailyStatItem(
+ day=str(row[0] or ""),
+ calls=int(row[1] or 0),
+ errors=int(row[2] or 0),
+ p50=float(row[3] or 0),
+ p95=float(row[4] or 0),
+ users=int(row[5] or 0),
+ sessions=int(row[6] or 0),
+ )
+ for row in (response.results or [])
+ ]
+ return MCPToolDailyStatsQueryResponse(
+ results=results,
+ timings=response.timings,
+ hogql=response.hogql,
+ modifiers=self.modifiers,
+ )
+
+
+class MCPToolDescriptionsQueryRunner(AnalyticsQueryRunner[MCPToolDescriptionsQueryResponse]):
+ query: MCPToolDescriptionsQuery
+ cached_response: CachedMCPToolDescriptionsQueryResponse
+
+ 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 to_query(self) -> ast.SelectQuery | ast.SelectSetQuery:
+ where = _tool_call_where(
+ self.query.toolName,
+ self.query_date_range,
+ extra=[
+ parse_expr("notEmpty({description})", placeholders={"description": parse_expr(_EFFECTIVE_DESCRIPTION)})
+ ],
+ )
+ return parse_select(
+ """
+ SELECT
+ {_EFFECTIVE_DESCRIPTION} AS description,
+ toString(max(timestamp)) AS last_seen
+ FROM events
+ WHERE {where}
+ GROUP BY description
+ ORDER BY last_seen DESC
+ LIMIT 5
+ """,
+ placeholders={"_EFFECTIVE_DESCRIPTION": parse_expr(_EFFECTIVE_DESCRIPTION), "where": where},
+ )
+
+ def _calculate(self) -> MCPToolDescriptionsQueryResponse:
+ with tags_context(
+ product=Product.MCP_ANALYTICS,
+ feature=Feature.QUERY,
+ team_id=self.team.id,
+ name="mcp_tool_descriptions_query",
+ ):
+ response = execute_hogql_query(
+ query=self.to_query(),
+ team=self.team,
+ query_type="mcp_tool_descriptions_query",
+ timings=self.timings,
+ modifiers=self.modifiers,
+ limit_context=self.limit_context,
+ )
+
+ results = [
+ MCPToolDescriptionItem(description=str(row[0] or ""), last_seen=str(row[1] or ""))
+ for row in (response.results or [])
+ ]
+ return MCPToolDescriptionsQueryResponse(
+ results=results,
+ timings=response.timings,
+ hogql=response.hogql,
+ modifiers=self.modifiers,
+ )
diff --git a/products/mcp_analytics/backend/tests/test_tool_tables.py b/products/mcp_analytics/backend/tests/test_tool_tables.py
index 5a988c95b94a..e85be9ff09df 100644
--- a/products/mcp_analytics/backend/tests/test_tool_tables.py
+++ b/products/mcp_analytics/backend/tests/test_tool_tables.py
@@ -5,10 +5,20 @@ from posthog.test.base import APIBaseTest, ClickhouseTestMixin, _create_event, _
from parameterized import parameterized
-from posthog.schema import DateRange, MCPToolFailuresQuery, MCPToolTopUsersQuery
+from posthog.schema import (
+ DateRange,
+ MCPToolDailyStatsQuery,
+ MCPToolDescriptionsQuery,
+ MCPToolFailuresQuery,
+ MCPToolStatsQuery,
+ MCPToolTopUsersQuery,
+)
from products.mcp_analytics.backend.hogql_queries.tool_tables import (
+ MCPToolDailyStatsQueryRunner,
+ MCPToolDescriptionsQueryRunner,
MCPToolFailuresQueryRunner,
+ MCPToolStatsQueryRunner,
MCPToolTopUsersQueryRunner,
)
from products.mcp_analytics.backend.tests import _MCPAnalyticsTeamScopedTestMixin
@@ -185,3 +195,130 @@ class TestMCPToolFailuresQueryRunner(_MCPAnalyticsTeamScopedTestMixin, Clickhous
rows = self._run()
assert {r.message for r in rows} == {"recent"}
+
+
+def _emit_tool_call(
+ team: Any,
+ *,
+ tool_name: str = "query_run",
+ distinct_id: str = "d1",
+ source: str | None = NEW_SDK_SOURCE,
+ is_error: bool = False,
+ duration_ms: float | None = None,
+ intent: str | None = None,
+ description: str | None = None,
+ session_id: 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 duration_ms is not None:
+ properties["$mcp_duration_ms"] = duration_ms
+ if intent is not None:
+ properties["$mcp_intent"] = intent
+ if description is not None:
+ properties["$mcp_tool_description"] = description
+ if session_id is not None:
+ properties["$mcp_session_id"] = session_id
+ if exec_tool is not None:
+ properties["$mcp_exec_tool_call_name"] = exec_tool
+ _create_event(
+ team=team,
+ event="$mcp_tool_call",
+ distinct_id=distinct_id,
+ timestamp=timestamp or datetime.now(tz=UTC),
+ properties=properties,
+ )
+
+
+class TestMCPToolStatsQueryRunner(_MCPAnalyticsTeamScopedTestMixin, ClickhouseTestMixin, APIBaseTest):
+ def _run(self, tool_name: str = "query_run") -> list[Any]:
+ runner = MCPToolStatsQueryRunner(
+ query=MCPToolStatsQuery(toolName=tool_name, dateRange=DateRange(date_from="-7d")),
+ team=self.team,
+ )
+ return runner.calculate().results
+
+ def test_empty_when_no_calls(self) -> None:
+ assert self._run() == []
+
+ def test_aggregates_scalars_and_intent_coverage(self) -> None:
+ _emit_tool_call(self.team, distinct_id="d1", duration_ms=100, intent='{"goal":"x"}', session_id="s1")
+ _emit_tool_call(self.team, distinct_id="d1", duration_ms=300, is_error=True, session_id="s1")
+ _emit_tool_call(self.team, distinct_id="d2", duration_ms=200, intent="{}", session_id="s2")
+ # Off-tool event must not leak into the aggregation (shared tool filter wiring).
+ _emit_tool_call(self.team, distinct_id="d3", tool_name="other", duration_ms=999)
+ flush_persons_and_events()
+
+ rows = self._run()
+
+ assert len(rows) == 1
+ row = rows[0]
+ assert row.calls == 3
+ assert row.errors == 1
+ assert row.users == 2
+ assert row.conversations == 2
+ # Only the '{"goal":"x"}' call counts; '{}' and missing do not.
+ assert row.with_intent == 1
+ assert row.p50_ms is not None and row.p95_ms is not None
+
+ def test_excludes_events_without_new_sdk_source(self) -> None:
+ _emit_tool_call(self.team, source=None, duration_ms=100)
+ flush_persons_and_events()
+
+ assert self._run() == []
+
+
+class TestMCPToolDailyStatsQueryRunner(_MCPAnalyticsTeamScopedTestMixin, ClickhouseTestMixin, APIBaseTest):
+ def _run(self, tool_name: str = "query_run") -> list[Any]:
+ runner = MCPToolDailyStatsQueryRunner(
+ query=MCPToolDailyStatsQuery(toolName=tool_name, dateRange=DateRange(date_from="-30d")),
+ team=self.team,
+ )
+ return runner.calculate().results
+
+ def test_groups_by_day_in_order(self) -> None:
+ now = datetime.now(tz=UTC)
+ _emit_tool_call(self.team, distinct_id="d1", session_id="s1", timestamp=now - timedelta(days=2))
+ _emit_tool_call(self.team, distinct_id="d2", session_id="s2", timestamp=now)
+ _emit_tool_call(self.team, distinct_id="d3", session_id="s3", timestamp=now)
+ flush_persons_and_events()
+
+ rows = self._run()
+
+ assert len(rows) == 2
+ assert rows[0].day < rows[1].day
+ assert rows[0].calls == 1
+ assert rows[1].calls == 2
+ assert rows[1].sessions == 2
+
+
+class TestMCPToolDescriptionsQueryRunner(_MCPAnalyticsTeamScopedTestMixin, ClickhouseTestMixin, APIBaseTest):
+ def _run(self, tool_name: str = "query_run") -> list[Any]:
+ runner = MCPToolDescriptionsQueryRunner(
+ query=MCPToolDescriptionsQuery(toolName=tool_name, dateRange=DateRange(date_from="-30d")),
+ team=self.team,
+ )
+ return runner.calculate().results
+
+ def test_distinct_descriptions_most_recent_first(self) -> None:
+ now = datetime.now(tz=UTC)
+ _emit_tool_call(self.team, description="old desc", timestamp=now - timedelta(days=3))
+ _emit_tool_call(self.team, description="old desc", timestamp=now - timedelta(days=2))
+ _emit_tool_call(self.team, description="new desc", timestamp=now)
+ flush_persons_and_events()
+
+ rows = self._run()
+
+ assert [r.description for r in rows] == ["new desc", "old desc"]
+
+ def test_excludes_empty_descriptions(self) -> None:
+ _emit_tool_call(self.team, description="")
+ _emit_tool_call(self.team, description="real")
+ flush_persons_and_events()
+
+ rows = self._run()
+
+ assert [r.description for r in rows] == ["real"]
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 70111ca489df..f71327dd6407 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -26823,6 +26823,132 @@ export namespace Schemas {
version?: number | null;
}
+ export interface MCPToolStatsItem {
+ calls: number;
+ conversations: number;
+ errors: number;
+ p50_ms?: number | null;
+ p95_ms?: number | null;
+ users: number;
+ /** Calls carrying a non-empty intent payload; the coverage denominator is `calls`. */
+ with_intent: number;
+ }
+
+ export interface MCPToolStatsQueryResponse {
+ /** 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;
+ /** Zero or one row; empty when the tool had no calls in the window. */
+ results: MCPToolStatsItem[];
+ /** Measured timings for different parts of the query generation process */
+ timings?: QueryTiming[] | 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. */
+ warnings?: DataWarehouseSyncWarning[] | null;
+ }
+
+ export interface MCPToolStatsQuery {
+ dateRange?: DateRange | null;
+ kind?: 'MCPToolStatsQuery';
+ /** Modifiers used when performing the query */
+ modifiers?: HogQLQueryModifiers | null;
+ response?: MCPToolStatsQueryResponse | 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 MCPToolDailyStatItem {
+ calls: number;
+ day: string;
+ errors: number;
+ p50: number;
+ p95: number;
+ sessions: number;
+ users: number;
+ }
+
+ export interface MCPToolDailyStatsQueryResponse {
+ /** 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: MCPToolDailyStatItem[];
+ /** Measured timings for different parts of the query generation process */
+ timings?: QueryTiming[] | 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. */
+ warnings?: DataWarehouseSyncWarning[] | null;
+ }
+
+ export interface MCPToolDailyStatsQuery {
+ dateRange?: DateRange | null;
+ kind?: 'MCPToolDailyStatsQuery';
+ /** Modifiers used when performing the query */
+ modifiers?: HogQLQueryModifiers | null;
+ response?: MCPToolDailyStatsQueryResponse | 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 MCPToolDescriptionItem {
+ description: string;
+ last_seen: string;
+ }
+
+ export interface MCPToolDescriptionsQueryResponse {
+ /** 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: MCPToolDescriptionItem[];
+ /** Measured timings for different parts of the query generation process */
+ timings?: QueryTiming[] | 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. */
+ warnings?: DataWarehouseSyncWarning[] | null;
+ }
+
+ export interface MCPToolDescriptionsQuery {
+ dateRange?: DateRange | null;
+ kind?: 'MCPToolDescriptionsQuery';
+ /** Modifiers used when performing the query */
+ modifiers?: HogQLQueryModifiers | null;
+ response?: MCPToolDescriptionsQueryResponse | 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;
+ }
+
/**
* Extra globals for the query
*/
@@ -26851,7 +26977,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 | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | 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 | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolDescriptionsQuery | null;
tags?: QueryLogTags | null;
/** Variables to be subsituted into the query */
variables?: HogQLMetadataVariables;
@@ -26877,7 +27003,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 | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | 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 | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | ExperimentFunnelsQuery | ExperimentTrendsQuery | CalendarHeatmapQuery | RecordingsQuery | TracesQuery | TraceQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolDescriptionsQuery | null;
/** Start position of the editor word */
startPosition: number;
tags?: QueryLogTags | null;
@@ -44404,7 +44530,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 | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | 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 | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolDescriptionsQuery | 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
@@ -46471,6 +46597,67 @@ export namespace Schemas {
}
export interface QueryResponseAlternative99 {
+ /** 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;
+ /** Zero or one row; empty when the tool had no calls in the window. */
+ results: MCPToolStatsItem[];
+ /** Measured timings for different parts of the query generation process */
+ timings?: QueryTiming[] | 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. */
+ warnings?: DataWarehouseSyncWarning[] | null;
+ }
+
+ export interface QueryResponseAlternative100 {
+ /** 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: MCPToolDailyStatItem[];
+ /** Measured timings for different parts of the query generation process */
+ timings?: QueryTiming[] | 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. */
+ warnings?: DataWarehouseSyncWarning[] | null;
+ }
+
+ export interface QueryResponseAlternative101 {
+ /** 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: MCPToolDescriptionItem[];
+ /** Measured timings for different parts of the query generation process */
+ timings?: QueryTiming[] | 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. */
+ warnings?: DataWarehouseSyncWarning[] | null;
+ }
+
+ export interface QueryResponseAlternative102 {
/** Query error. Returned only if 'explain' or `modifiers.debug` is true. Throws an error otherwise. */
error?: string | null;
/** Generated HogQL query. */
@@ -46490,18 +46677,18 @@ export namespace Schemas {
warnings?: DataWarehouseSyncWarning[] | 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 | QueryResponseAlternative65 | QueryResponseAlternative66 | QueryResponseAlternative67 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative73 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative78 | QueryResponseAlternative79 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative82 | QueryResponseAlternative83 | QueryResponseAlternative84 | QueryResponseAlternative85 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative89 | QueryResponseAlternative90 | QueryResponseAlternative91 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99;
+ 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 | QueryResponseAlternative65 | QueryResponseAlternative66 | QueryResponseAlternative67 | QueryResponseAlternative68 | QueryResponseAlternative69 | QueryResponseAlternative70 | QueryResponseAlternative71 | QueryResponseAlternative73 | QueryResponseAlternative74 | QueryResponseAlternative75 | QueryResponseAlternative76 | QueryResponseAlternative77 | QueryResponseAlternative78 | QueryResponseAlternative79 | QueryResponseAlternative80 | QueryResponseAlternative81 | QueryResponseAlternative82 | QueryResponseAlternative83 | QueryResponseAlternative84 | QueryResponseAlternative85 | QueryResponseAlternative86 | QueryResponseAlternative87 | QueryResponseAlternative89 | QueryResponseAlternative90 | QueryResponseAlternative91 | QueryResponseAlternative92 | QueryResponseAlternative93 | QueryResponseAlternative94 | QueryResponseAlternative95 | QueryResponseAlternative96 | QueryResponseAlternative97 | QueryResponseAlternative98 | QueryResponseAlternative99 | QueryResponseAlternative100 | QueryResponseAlternative101 | QueryResponseAlternative102;
export interface QueryStatusResponse {
query_status: QueryStatus;
}
export interface QueryUpgradeRequest {
- query: EventsNode | ActionsNode | PersonsNode | DataWarehouseNode | FunnelsDataWarehouseNode | LifecycleDataWarehouseNode | EventsQuery | SessionsQuery | ActorsQuery | GroupsQuery | InsightActorsQuery | InsightActorsQueryOptions | SessionsTimelineQuery | HogQuery | HogQLQuery | HogQLMetadata | HogQLAutocomplete | SessionAttributionExplorerQuery | 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 | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | 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 | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolDescriptionsQuery | 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 | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | 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 | TraceSpansQuery | TraceSpansAggregationQuery | TraceSpansTreeQuery | TraceSpansAttributeBreakdownQuery | SuggestedQuestionsQuery | TeamTaxonomyQuery | EventTaxonomyQuery | ActorsPropertyTaxonomyQuery | TracesQuery | TraceQuery | TraceNeighborsQuery | VectorSearchQuery | UsageMetricsQuery | AccountsQuery | EndpointsUsageOverviewQuery | EndpointsUsageTableQuery | EndpointsUsageTrendsQuery | MCPHarnessBreakdownQuery | MCPToolTopUsersQuery | MCPToolFailuresQuery | MCPToolStatsQuery | MCPToolDailyStatsQuery | MCPToolDescriptionsQuery | PropertyValuesQuery;
}
export interface QuotaResourceLimit {