posthog_hogql
Run an arbitrary HogQL (SQL) query against PostHog data. Use for custom analysis not covered by other tools. Only works if PostHog is connected.
This record as markdown: /tools/com-getfreedomos-freedom-mcp/posthog-hogql.md
What posthog_hogql does on Freedom Mcp
AI agents invoke posthog_hogql to trigger actions in Freedom Mcp. What it does depends on the arguments the agent supplies, and its effects often reach beyond the immediate call: builds kicked off, notifications sent, workflows started.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | number | — | Max rows to return (default: 100) |
query | string | Yes | HogQL query string |
companyId | string | Yes | FreedomOS company id to act within (you must be a member). Required for company-scoped tools. |
Parameters from the server's own tool schema.
Why posthog_hogql is rated High
Although the tool is read-focused in typical usage (querying analytics data), the ability to execute arbitrary SQL queries qualifies it as Execute under the rule that category judgment is based on what the tool DOES, not its name. An AI agent with unrestricted SQL execution could exfiltrate sensitive customer data, modify events/properties, or cause performance issues.
From the tool's definition 'Run an arbitrary HogQL (SQL) query' — the tool permits execution of arbitrary SQL queries against a data warehouse, which is a classic Execute pattern. HogQL is PostHog's SQL dialect and 'arbitrary' indicates no restrictions on query scope.
Attacks that exploit this kind of access
The rule that runs posthog_hogql safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Freedom Mcp, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For posthog_hogql, this is the rule to start with:
posthog_hogql stays usable, but rate-capped: a runaway agent can't fire it dozens of times a minute. Everything else on the server is denied unless you say otherwise.
The button opens the PolicyLayer dashboard: create your workspace, connect Freedom Mcp, apply this rule, and every posthog_hogql call is checked against it from then on.
Questions about posthog_hogql
Run an arbitrary HogQL (SQL) query against PostHog data. Use for custom analysis not covered by other tools. Only works if PostHog is connected. It is categorised as a Execute tool in the Freedom Mcp MCP Server, which means it can trigger actions or run processes. Use rate limits and argument validation.
posthog_hogql accepts 3 parameters: limit, query, companyId. Required: query, companyId. The full parameter table on this page comes from the server's own tool schema.
Register the Freedom MCP server in PolicyLayer and add a rule for posthog_hogql: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Freedom Mcp. Nothing to install.
posthog_hogql is a Execute tool with high risk. Execute tools should be rate-limited and have argument validation enabled.
Yes. Add a rate_limit block to the posthog_hogql rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for posthog_hogql. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
posthog_hogql is provided by the Freedom MCP server (https://twuluxmoognlwtmaoqgo.supabase.co/functions/v1/freedom-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on Freedom, and thousands of servers like it.
Across the catalogue