posthog_query
Ask PostHog a question in HogQL read-only
Description
ASK POSTHOG A QUESTION IN HogQL — their SQL dialect over the `events`, `persons` and `sessions` tables. Use it for per-user funnels, retention and custom breakdowns, e.g. `SELECT properties.$current_url, count() FROM events WHERE event = '$pageview' AND timestamp > now() - INTERVAL 7 DAY GROUP BY 1 ORDER BY 2 DESC`. IT IS NOT AN EXPORTER AND MUST NEVER BE LOOPED — PostHog's own policy, verbatim: "Third-party connectors must use batch exports, not /query. Connectors built on /query are not supported and will be rate-limited or rejected." Ask ONE bounded question. Do not paginate it, do not schedule it, and do not call it repeatedly to assemble a whole table; if the user genuinely needs bulk data, tell them to set up a PostHog batch export. Every query is capped at 1000 rows, and OFFSET is refused outright because PostHog returns HTTP 400 for it on API keys — use keyset pagination on `timestamp` (events) or `id` (persons) if a second page is truly needed. Read-only, 0 credits.
Parameters
| Parameter | Type | Description |
|---|---|---|
queryrequired | string | a HogQL (ClickHouse-flavoured SQL) query — one bounded question, never a page of an export |
limit | number | row cap, 1–1000 (default 1000). A LIMIT already in the query is honoured and clamped to the same ceiling |
Example call
Every required parameter is shown, filled from the schema where it gives a value and otherwise with a placeholder naming the type. Replace the placeholders with real values. The same call works on the MCP server, the CLI and POST https://app.hermoso.ai/v1/tools/posthog_query.
MCP (tools/call)
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"posthog_query","arguments":{"query":"<string>"}}}
CLI
hermoso call posthog_query --json '{"query":"<string>"}'
Credits
Credits are spent only on two things: running an AI model (image, video, voice, text, planning, post-production) and Ad Spy research. See Credits & costs.
Related tools
list_posthog_projectsList the PostHog projects this key can seeposthog_insightRead a saved PostHog insight (funnel / retention / trend)list_posthog_session_recordingsList PostHog session replaysposthog_personsLook up people in PostHogmixpanel_insightsRead a saved Mixpanel reportmixpanel_retentionMixpanel retention cohortsmixpanel_segmentationMixpanel event segmentation (maintenance mode)mixpanel_funnelRead a saved Mixpanel funnel (maintenance mode)list_mixpanel_eventsList Mixpanel events (or one event’s properties)amplitude_segmentationAmplitude event segmentation