Query insights
query_insightsQuery runs a product-analytics insight over the project's events and returns the computed result. A single call covers every insight type — trends, segmentation, funnel, retention, user flow (Sankey), top-K and map (a metric per country, returned as top_k rows keyed by ISO alpha-2) — chosen by the InsightQuerySpec (its insight_type, events, breakdowns and filters, among others). Map, user flow, top-K and session each carry their own sub-message (spec.map / spec.user_flow / spec.top_k / spec.session) and take no events or breakdowns; a map's country dimension is implicit, so spec.map may be empty. The request also carries the time range and granularity, and it is the right tool for any project-wide or over-time question; per-granularity range caps apply. Traffic tagged as a bot at ingest is excluded unless spec.include_bots is true. Discover valid event kinds and property keys with the get_insights_filter_schema tool first.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "query_insights"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spec | No | ||
| timezone | No | ||
| project_id | No | The id of the project, from list_projects. | |
| time_range | No | ||
| granularity | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | No | Exactly one of the "result" group. Set "which" to the chosen field name, then set only that field. |