Skip to main content
Glama

PostHog HogQL

posthog_hogql
Read-onlyIdempotent

Run an arbitrary HogQL (SQL) query against PostHog data. Use for custom analysis not covered by other tools. Only works if PostHog is connected.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax rows to return (default: 100)
queryYesHogQL query string. HogQL is ClickHouse-compatible SQL; common tables: events, persons, sessions. Example: "SELECT count() FROM events WHERE event = '$pageview' AND timestamp > now() - interval 7 day"
companyIdYesFreedomOS company id to act within (you must be a member). Required for company-scoped tools.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / query / description
      Previous value: -"HogQL query string"New value: +"HogQL query string. HogQL is ClickHouse-compatible SQL; common tables: events, persons, sessions. Example: \"SELECT count() FROM events WHERE event = '$pageview' AND timestamp > now() - interval 7 day\""
  2. First observed

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, covering the safety profile. The description adds value beyond that by disclosing the environmental dependency that it only works when PostHog is connected. It doesn't address arbitrary-query risks like timeouts or heavy loads, but with annotations present, 4 is appropriate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences with no filler: the core action, the use case, and the prerequisite are all front-loaded. Every clause earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a free-form query tool, the description plus the fully covered schema covers the essential needs: what to do, when to use it, and a critical prerequisite. It doesn't describe return value structure or query performance caveats, but annotations and schema and the open-world hint cover enough of the context for an agent to operate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already documents all parameters, including an example query and a description of HogQL tables. The tool description itself adds no additional parameter-level semantics, so the baseline of 3 is correct.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Run an arbitrary HogQL (SQL) query against PostHog data.' It also distinguishes itself from sibling tools by noting it is for 'custom analysis not covered by other tools,' which clearly positions this as the generic query fallback among the specialized posthog_* tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear usage context: 'Use for custom analysis not covered by other tools' and adds the prerequisite 'Only works if PostHog is connected.' It does not name specific alternative tools or state explicit when-not-to-use conditions, but the guidance is sufficient for an agent to select it appropriately.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources