Skip to content

chore(mcp-analytics): refresh mcp analytics skills - #70743

Merged
gesh merged 3 commits into
masterfrom
georgis/refresh-mcp-analytics-skills
Jul 16, 2026
Merged

chore(mcp-analytics): refresh mcp analytics skills#70743
gesh merged 3 commits into
masterfrom
georgis/refresh-mcp-analytics-skills

Conversation

@gesh

@gesh gesh commented Jul 14, 2026

Copy link
Copy Markdown
Member

Problem

The exploring-mcp-sessions skill was a version behind the tools it documents. It told agents to hand-write HogQL for listing sessions and reading a session's tool calls, but both have had typed tools since #67315 (mcp-analytics-sessions-list) and #68169 (mcp-analytics-sessions-tool-calls). The skill was last touched before either landed.

Reviewing the sibling skills turned up more that no longer held. models-mcp.md, the shared reference all four skills point at, still claimed the session REST tools were disabled. And exploring-mcp-tool-quality told agents the frontend was the source of truth for harness bucketing, which would send them to harnessRegistry.ts (a label to logo lookup) instead of mcp_harness.py, where it actually happens.

Changes

exploring-mcp-sessions now leads with the typed tools and keeps SQL only for what they genuinely don't cover:

  • errored-session filtering, since the session list has no error filter and no error count on a row
  • effective tool names inside a session, since mcp-analytics-sessions-tool-calls returns the raw $mcp_tool_name and does not resolve the inner tool of a single-exec wrapper call
  • cross-session aggregation
  • projects without the mcp-analytics flag, since execute-sql is ungated while the typed tools are not

Note

Two behaviors worth knowing, now documented in the skill. Both detail tools default to a 7-day lookback, so a session older than that returns empty unless you pass its session_start as date_from - the failure looks like missing data but is not. And the typed tools report the raw tool name, which contradicts the "always use the effective tool name" rule the tool-quality skill leads with. That inconsistency may be worth fixing in the endpoint rather than documenting around.

The rest is corrections: the disabled-tools claim in models-mcp.md, the harness-bucketing source of truth in exploring-mcp-tool-quality, a sessions table in the shared reference to match the per-tool one above it, and tool names spelled out in full everywhere instead of elided as ...-tool-calls, so an agent can paste them.

Docs only. No production code touched.

How did you test this code?

hogli lint:skills passes, 117 skills. It validates that every tool a skill references exists in the catalog, which is what catches the stale names. The two warnings it prints are pre-existing and in engineering_analytics, unrelated to this PR.

Worth flagging that this linter only catches references to tools that don't exist. It cannot catch a skill failing to mention tools that do - which is exactly the rot this PR fixes, and why it went unnoticed for two releases.

I did not run the MCP eval harness. It would not exercise these skills anyway: evals score whether an agent picks the right tool against a live server, and they never read skills.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

I asked Claude to update exploring-mcp-sessions and then review whether the other MCP skills and tools needed the same treatment. It read the tools.yaml, the generated tool definitions, and the query runners rather than trusting the skills' own descriptions, which is how the staleness got pinned to specific PRs and how the raw-vs-effective tool name gap turned up.

A few things were deliberately left out of this PR:

  • The sessions-list tool description says "one row per $mcp_session_id" while the SQL groups on $session_id. Same id, so this is a spelling inconsistency rather than a bug, but fixing it means regenerating OpenAPI and the MCP tools. Separate PR.
  • query-mcp-tool-stats returns a field named conversations while query-mcp-tool-daily-stats returns sessions for the same thing, and the tool description promises "sessions". Renaming touches the schema, the runner, and the frontend. Separate PR.
  • The eval benchmark has no task covering either session tool. Real gap, but it changes the exam, so per the improving-mcp-tools guardrail it bumps version and goes on its own.

Claude initially drew a sessions-vs-conversations distinction from the _CONVERSATION_ID coalesce in the query runners. I corrected it: same id, and "conversation" means something else in this product. That's now consistent across the skills.

The exploring-mcp-sessions skill still told agents to hand-write HogQL for
listing sessions and reading a session's tool calls. Both have had typed tools
since #67315 and #68169, so the skill was a version behind the tools it
documents.

Lead with mcp-analytics-sessions-list / -sessions-tool-calls, and keep SQL for
the cases the typed tools genuinely don't cover: errored-session filtering (the
session list has no error filter or error count), effective tool names inside a
session (the tool-calls endpoint returns the raw $mcp_tool_name), cross-session
aggregation, and projects without the mcp-analytics flag, since execute-sql is
ungated while the typed tools are not.

Also fixes claims in the sibling skills that no longer held: models-mcp.md said
the session REST tools were disabled, and exploring-mcp-tool-quality said the
frontend was the source of truth for harness bucketing when it is resolved
server-side in mcp_harness.py. Tool names are now spelled out in full rather
than elided, so an agent can paste them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gesh gesh added the skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs label Jul 14, 2026
@gesh gesh self-assigned this Jul 14, 2026
@gesh gesh added the skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs label Jul 14, 2026
@gesh
gesh marked this pull request as ready for review July 14, 2026 14:16
@gesh
gesh requested a review from a team July 14, 2026 14:16
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team July 14, 2026 14:17
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "chore(mcp-analytics): refresh mcp analyt..." | Re-trigger Greptile

Comment thread products/posthog_ai/skills/querying-posthog-data/references/models-mcp.md Outdated
Comment thread products/mcp_analytics/skills/exploring-mcp-sessions/SKILL.md Outdated
gesh and others added 2 commits July 14, 2026 17:22
…d_count

Two corrections from review, both verified against the backend.

query-mcp-harness-breakdown's optional toolName goes through tool_scope_exprs,
which adds a $mcp_source = 'posthog_mcp_analytics' predicate alongside the
effective-tool one. Scoping to a tool therefore drops old-SDK and third-party
calls, so a harness can be undercounted. Say so, and point one-tool cuts across
all SDK sources at execute-sql.

The session list returns distinct_id_count but logic.py hardcodes it to 0, so an
agent reading it would report zero distinct ids for every session. Drop it from
the documented row and call out that it is never populated, rather than staying
silent about a field that is still in the response.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-analytics-skills

# Conflicts:
#	products/posthog_ai/skills/querying-posthog-data/references/models-mcp.md
@gesh
gesh merged commit 4bdb263 into master Jul 16, 2026
181 checks passed
@gesh
gesh deleted the georgis/refresh-mcp-analytics-skills branch July 16, 2026 14:56
@deployment-status-posthog

deployment-status-posthog Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-07-16 15:52 UTC Run
prod-us ✅ Deployed 2026-07-16 16:08 UTC Run
prod-eu ✅ Deployed 2026-07-16 16:07 UTC Run

rnegron pushed a commit that referenced this pull request Jul 16, 2026
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants