/exploring-mcp-tool-quality
Investigate the quality of PostHog MCP tool calls — error rates, latency, reach, and which tools are failing or slow. Use when the user asks "which MCP tool has the highest error rate?", "what's the slowest tool?", "which tools fail most often?", "how reliable is tool X?", wants
$ npx -y skills add posthog/posthog --skill exploring-mcp-tool-quality --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/exploring-mcp-tool-quality
Context preview
The summary Claude sees to decide when to auto-load this skill.
Investigate the quality of PostHog MCP tool calls — error rates, latency, reach, and which tools are failing or slow. Use when the user asks "which MCP tool has the highest error rate?", "what's the slowest tool?", "which tools fail most often?", "how reliable is tool X?", wants
SKILL.md
exploring-mcp-tool-quality.SKILL.mdname: exploring-mcp-tool-quality
description: >
Investigate the quality of PostHog MCP tool calls — error rates, latency,
reach, and which tools are failing or slow. Use when the user asks "which
MCP tool has the highest error rate?", "what's the slowest tool?", "which
tools fail most often?", "how reliable is tool X?", wants a tool-quality
matrix, or pastes an MCP analytics tool-quality / dashboard URL and asks
what it shows.
Exploring MCP tool quality
Any MCP server instrumented with PostHog's MCP analytics SDK emits a `$mcp_tool_call` event on the shared `events` table every time an agent invokes a tool. There is **no dedicated ClickHouse table** — every field lives as a `$mcp_*` property on `events`, and every tool-quality metric (error rate, latency percentiles, reach) is an aggregation over this one event. This is the data behind the MCP analytics dashboard and tool-quality screens.
**For a single tool, prefer the typed tools** — `posthog:query-mcp-tool-stats` (calls, errors, p50/p95, users, sessions, intents), `posthog:query-mcp-tool-failures` (top error messages by harness), and `posthog:query-mcp-tool-daily-stats` (day-by-day trend). Each takes a `toolName` + `dateRange`, runs the same query runner as the tool-detail UI, and is gated behind the `mcp-analytics` flag — no hand-written SQL needed.
**HogQL via `posthog:execute-sql` is the path for cross-tool questions** — the "which tool errors most" ranking below has no typed tool, so rank with SQL, then drill into the worst tool with `posthog:query-mcp-tool-stats` and `posthog:query-mcp-tool-failures`. The full property schema and the canonical query recipes live in the shared MCP data reference: [`products/posthog_ai/skills/querying-posthog-data/references/models-mcp.md`](../../../posthog_ai/skills/querying-posthog-data/references/models-mcp.md). That reference is the single source of truth for the `$mcp_*` schema and the effective-tool-name idiom used below — this skill inlines only the headline "which tool errors most" query for convenience; pull the matrix, latency, and harness recipes from the reference rather than re-deriving them. Read it before writing queries.
The two rules that matter most
- **Always use the effective tool name.** New-SDK events wrap the real tool in
a single-exec call, so grouping on raw `$mcp_tool_name` collapses everything under the wrapper. Use:
coalesce(nullIf(toString(properties.$mcp_exec_tool_call_name), ''), toString(properties.$mcp_tool_name))
- **Always read `$mcp_is_error` via `toBool(...)`** and cast
`$mcp_duration_ms` via `toFloat(...)`. The properties are strings.
Always set a time range — these queries scan `events` otherwise.
Workflow: which tool has the highest error rate
This is the canonical "which tool errors most" question. Rank tools by error rate, but guard against small-sample noise with a `HAVING` floor on call volume:
posthog:execute-sql
SELECT
coalesce(nullIf(toString(properties.$mcp_exec_tool_call_name), ''), toString(properties.$mcp_tool_name)) AS tool,
count() AS total_calls,
countIf(toBool(properties.$mcp_is_error)) AS errors,
round(countIf(toBool(properties.$mcp_is_error)) * 100.0 / count(), 1) AS error_rate_pct
FROM events
WHERE event = '$mcp_tool_call'
AND coalesce(nullIf(toString(properties.$mcp_exec_tool_call_name), ''), toString(properties.$mcp_tool_name)) != ''
AND timestamp >= now() - INTERVAL 30 DAY
GROUP BY tool
HAVING total_calls >= 20
ORDER BY error_rate_pct DESC, total_calls DESC
LIMIT 20Report both **rate and volume** — a 100% error rate over 3 calls is rarely the real story; a 12% rate over 50,000 calls is. Offer to pull the top `$mcp_error_message` values for the worst tool (see below).
Workflow: tool-quality matrix
One row per tool with error rate, latency percentiles, and reach — mirrors the tool-quality screen. The ready-to-run query is in [models-mcp.md](../../../posthog_ai/skills/querying-posthog-data/references/models-mcp.md) under "Tool-quality matrix".
Workflow: why is a tool failing
For one tool's top failure buckets (grouped by harness), call `posthog:query-mcp-tool-failures` with the `toolName` — it's the typed equivalent of the query below. Failures come from the **same source as the error rate**: errored `$mcp_tool_call` events (`$mcp_is_error`), scoped by the effective tool name. Failures are grouped by `$mcp_error_type` (a semantic bucket: `internal`, `validation`, `api_4xx`, `api_5xx`, `permission`, `timeout`, `rate_limited`, `missing_context`) and the HTTP `$mcp_error_status` when present. To see individual errored calls inside a bucket — with the captured `$mcp_error_message`, session id, harness, and intent — pass the bucket's raw `error_type`/`error_status` to `posthog:query-mcp-tool-failure-occurrences` (`$mcp_error_message` is empty on events captured before message capture shipped):
posthog:execute-sql
SELECT
concat(
coalesce(nullIf(toString(properties.$mcp_error_type), ''), 'unknown'),
if(empty(coalesce(toString(properties.$mcp_error_status), '')), '',
concat(' (HTTP ', coalesce(toString(properties.$mcp_error_status), ''), ')'))
) AS failure,
count() AS n
FROM events
WHERE event = '$mcp_tool_call'
AND toBool(properties.$mcp_is_error)
AND coalesce(nullIf(toString(properties.$mcp_exec_tool_call_name), ''), toString(properties.$mcp_tool_name)) = '<tool>'
AND timestamp >= now() - INTERVAL 30 DAY
GROUP BY failure ORDER BY n DESC LIMIT 10`$mcp_error_type` is only populated on newer SDK/server paths — a chunk of errored calls carry neither type nor status and fall into the `unknown` bucket.
Workflow: slowest tools
Swap the aggregate for latency percentiles (`quantile(0.95)(toFloat(properties.$mcp_duration_ms))`) and order by `p95_ms`. The matrix query already returns `p50_ms` / `p95_ms`.
Constructing UI links
- **Dashboard**: `https://app.posthog.com/project/<
Read more
name: exploring-mcp-tool-quality description: > Investigate the quality of PostHog MCP tool calls — error rates, latency, reach, and which tools are failing or slow. Use when the user asks "which MCP tool has the highest error rate?", "what's the slowest tool?", "which tools fail most often?", "how reliable is tool X?", wants a tool-quality matrix, or pastes an MCP analytics tool-quality / dashboard URL and asks what it shows.
Exploring MCP tool quality
Any MCP server instrumented with PostHog's MCP analytics SDK emits a `$mcp_tool_call` event on the shared `events` table every time an agent invokes a tool. There is **no dedicated ClickHouse table** — every field lives as a `$mcp_*` property on `events`, and every tool-quality metric (error rate, latency percentiles, reach) is an aggregation over this one event. This is the data behind the MCP analytics dashboard and tool-quality screens.
**For a single tool, prefer the typed tools** — `posthog:query-mcp-tool-stats` (calls, errors, p50/p95, users, sessions, intents), `posthog:query-mcp-tool-failures` (top error messages by harness), and `posthog:query-mcp-tool-daily-stats` (day-by-day trend). Each takes a `toolName` + `dateRange`, runs the same query runner as the tool-detail UI, and is gated behind the `mcp-analytics` flag — no hand-written SQL needed.
**HogQL via `posthog:execute-sql` is the path for cross-tool questions** — the "which tool errors most" ranking below has no typed tool, so rank with SQL, then drill into the worst tool with `posthog:query-mcp-tool-stats` and `posthog:query-mcp-tool-failures`. The full property schema and the canonical query recipes live in the shared MCP data reference: [`products/posthog_ai/skills/querying-posthog-data/references/models-mcp.md`](../../../posthog_ai/skills/querying-posthog-data/references/models-mcp.md). That reference is the single source of truth for the `$mcp_*` schema and the effective-tool-name idiom used below — this skill inlines only the headline "which tool errors most" query for convenience; pull the matrix, latency, and harness recipes from the reference rather than re-deriving them. Read it before writing queries.
The two rules that matter most
- **Always use the effective tool name.** New-SDK events wrap the real tool in
a single-exec call, so grouping on raw `$mcp_tool_name` collapses everything under the wrapper. Use:
coalesce(nullIf(toString(properties.$mcp_exec_tool_call_name), ''), toString(properties.$mcp_tool_name))
- **Always read `$mcp_is_error` via `toBool(...)`** and cast
`$mcp_duration_ms` via `toFloat(...)`. The properties are strings.
Always set a time range — these queries scan `events` otherwise.
Workflow: which tool has the highest error rate
This is the canonical "which tool errors most" question. Rank tools by error rate, but guard against small-sample noise with a `HAVING` floor on call volume:
posthog:execute-sql
SELECT
coalesce(nullIf(toString(properties.$mcp_exec_tool_call_name), ''), toString(properties.$mcp_tool_name)) AS tool,
count() AS total_calls,
countIf(toBool(properties.$mcp_is_error)) AS errors,
round(countIf(toBool(properties.$mcp_is_error)) * 100.0 / count(), 1) AS error_rate_pct
FROM events
WHERE event = '$mcp_tool_call'
AND coalesce(nullIf(toString(properties.$mcp_exec_tool_call_name), ''), toString(properties.$mcp_tool_name)) != ''
AND timestamp >= now() - INTERVAL 30 DAY
GROUP BY tool
HAVING total_calls >= 20
ORDER BY error_rate_pct DESC, total_calls DESC
LIMIT 20Report both **rate and volume** — a 100% error rate over 3 calls is rarely the real story; a 12% rate over 50,000 calls is. Offer to pull the top `$mcp_error_message` values for the worst tool (see below).
Workflow: tool-quality matrix
One row per tool with error rate, latency percentiles, and reach — mirrors the tool-quality screen. The ready-to-run query is in [models-mcp.md](../../../posthog_ai/skills/querying-posthog-data/references/models-mcp.md) under "Tool-quality matrix".
Workflow: why is a tool failing
For one tool's top failure buckets (grouped by harness), call `posthog:query-mcp-tool-failures` with the `toolName` — it's the typed equivalent of the query below. Failures come from the **same source as the error rate**: errored `$mcp_tool_call` events (`$mcp_is_error`), scoped by the effective tool name. Failures are grouped by `$mcp_error_type` (a semantic bucket: `internal`, `validation`, `api_4xx`, `api_5xx`, `permission`, `timeout`, `rate_limited`, `missing_context`) and the HTTP `$mcp_error_status` when present. To see individual errored calls inside a bucket — with the captured `$mcp_error_message`, session id, harness, and intent — pass the bucket's raw `error_type`/`error_status` to `posthog:query-mcp-tool-failure-occurrences` (`$mcp_error_message` is empty on events captured before message capture shipped):
posthog:execute-sql
SELECT
concat(
coalesce(nullIf(toString(properties.$mcp_error_type), ''), 'unknown'),
if(empty(coalesce(toString(properties.$mcp_error_status), '')), '',
concat(' (HTTP ', coalesce(toString(properties.$mcp_error_status), ''), ')'))
) AS failure,
count() AS n
FROM events
WHERE event = '$mcp_tool_call'
AND toBool(properties.$mcp_is_error)
AND coalesce(nullIf(toString(properties.$mcp_exec_tool_call_name), ''), toString(properties.$mcp_tool_name)) = '<tool>'
AND timestamp >= now() - INTERVAL 30 DAY
GROUP BY failure ORDER BY n DESC LIMIT 10`$mcp_error_type` is only populated on newer SDK/server paths — a chunk of errored calls carry neither type nor status and fall into the `unknown` bucket.
Workflow: slowest tools
Swap the aggregate for latency percentiles (`quantile(0.95)(toFloat(properties.$mcp_duration_ms))`) and order by `p95_ms`. The matrix query already returns `p50_ms` / `p95_ms`.
Constructing UI links
- **Dashboard**: `https://app.posthog.com/project/<
:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Repo: posthog/posthog
Other skills on posthog.
- /analyzing-expensive-users
Analyze the most expensive users in AI observability and explain why they cost so much. Use when the user asks about top spenders, expensive users, per-user LLM cost, user-level cost drivers, or patterns behind high AI observability spend.
Open skill - /creating-online-evaluations
Author continuously-running online evaluations in PostHog AI observability, grounded in real failure modes you've identified. Use when the user wants evaluations that automatically score new generations or whole traces going forward — "create an eval to catch X", "continuously
Open skill - /exploring-ai-failures
Find where an AI/LLM application is failing in production and surface the failure patterns, working from real traces. Use when someone wants to understand what's going wrong with an AI feature, find and categorize failure modes, triage errors, or investigate quality issues
Open skill - /exploring-llm-clusters
Investigate AI observability clusters — understand usage patterns in AI/LLM traffic, compare cluster behavior, compute cost/latency metrics, and drill into individual traces within clusters.
Open skill - /exploring-llm-costs
Investigate LLM spend in PostHog — total cost over time, cost by model, provider, user, trace, or custom dimension, token and cache-hit economics, and cost regressions. Use when the user asks "how much are we spending on LLMs?", "which model / user / feature is most expensive?",
Open skill - /exploring-llm-evaluations
Investigate AI observability evaluations — `hog` (deterministic code-based), `llm_judge` (LLM-prompt-based), and `sentiment` (user-message sentiment). Find existing evaluations, inspect their configuration, run them against specific generations, query individual results, and
Open skill

