Run a HogQL query
posthog_queryExecute HogQL queries against PostHog data to analyze events, persons, sessions, groups, and session replays. Filter and aggregate with SQL-like syntax for custom insights.
Instructions
Runs a HogQL (ClickHouse SQL dialect) query: tables events, persons, sessions, groups, raw_session_replay_events. Example: SELECT event, count() FROM events WHERE timestamp > now() - INTERVAL 7 DAY GROUP BY event ORDER BY 2 DESC LIMIT 20.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "posthog_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | HogQL query text | |
| project_id | No | Project id; defaults to POSTHOG_PROJECT_ID |