exploring-mcp-sessions
它能做什么
本技能展示某个 AI 智能体在单次运行中进行的工具调用顺序,以及它在哪里出错。适合运行 MCP 服务器、并希望了解某次特定会话的人。
适用场景
- ✓当你想查看某一次具体 MCP 会话中发生了什么时。
- ✓当你需要找出哪些会话出现过错误的时候。
- ✓当你想知道谁正在连接你的 MCP 服务器的时候。
技能链接
https://github.com/PostHog/posthog/blob/master/products/mcp_analytics/skills/exploring-mcp-sessions/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请显示这次 MCP 会话的工具调用,并告诉我该智能体想做什么。”
每周 5 个新技能,1 分钟读完。
工作原理
它会列出会话,按时间顺序读取某个会话的工具调用,并可以撰写一份关于其目标的简短摘要。只有最困难的问题才需要自定义查询。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Exploring MCP sessions
An MCP session is one agent run: the set of $mcp_tool_call events sharing a
$session_id, ordered by timestamp.
Listing sessions, reading a session's tool calls, and summarising its goal each
have a typed tool — reach for those first. Drop to HogQL only for the three
things the typed tools genuinely can't do (see
When to drop to SQL). The full $mcp_* property schema
and query recipes live in the shared reference:
models-mcp.md.
Tools
| Tool | Purpose |
|---|---|
posthog:mcp-analytics-sessions-list |
List sessions — one row per session, newest first |
posthog:mcp-analytics-sessions-tool-calls |
One session's tool calls, chronological |
posthog:mcp-analytics-sessions-generate-intent |
LLM summary of a session's goal (cached after first call) |
posthog:execute-sql |
Errored sessions, effective tool names, cross-session cuts |
The three mcp-analytics-* tools run the same code as the sessions UI, so results
match the screen. If they aren't in your tool list, fall back to posthog:execute-sql.
The date-window trap — read this first
The two detail tools default to a 7-day lookback. A session you found in a
list that reaches further back will come back empty unless you pass its
session_start as date_from:
posthog:mcp-analytics-sessions-tool-calls—date_fromis an absolute ISO timestamp; pass thesession_startyou got fromposthog:mcp-analytics-sessions-list.posthog:mcp-analytics-sessions-generate-intent— samedate_fromquery param, same reason.
Empty tool calls for a session that visibly exists is almost always this, not a
data problem. Carry session_start forward from the list row.
Workflow: list recent sessions
posthog:mcp-analytics-sessions-list
{ "date_from": "-7d", "order_by": "-session_start", "limit": 100 }
Each row: session_id, tool_calls, session_start, session_end,
tools_used, mcp_client_name, distinct_id (+ resolved person_email /
person_name), and intent (empty until generated). Response is
{ results, has_next } — page with limit / offset.
Three sharp edges:
order_bytakes column names, not response field names. Sort call volume astool_call_count(nottool_calls).duration_secondssorts fine even though it isn't returned. An unrecognised key silently falls back to newest-first — so verify the order you got is the order you asked for. Valid:session_id,session_start,session_end,duration_seconds,tool_call_count,mcp_client_name,distinct_id; prefix-to descend.- There is no error filter and no error count on a session row. "Which sessions had errors?" is a SQL question — see below.
distinct_id_countis always0. The field is in the response but the backend never populates it, so don't read it as "one distinct id per session" — it says nothing. To count distinct ids in a session, use SQL.
search does a case-insensitive substring match across session_id,
distinct_id, mcp_client_name, and tools_used.
Workflow: read one session's tool calls
posthog:mcp-analytics-sessions-tool-calls
{ "id": "<session_id>", "date_from": "<session_start>", "limit": 500 }
Chronological tool_name, intent, timestamp, duration_ms, is_error,
error_message — read top to bottom to reconstruct the run. limit defaults to
500 (also the max), which is the whole page for almost every session; has_next
tells you if more remain.
Caveat: tool_name here is the raw $mcp_tool_name. Unlike the tool-quality
and tool-detail tools, this endpoint does not resolve the inner tool of a
single-exec wrapper call, so wrapper calls show the wrapper. When the inner tool
is what matters (comparing against a tool-quality ranking, tracing a specific
tool through a run), use the SQL recipe below instead. The same applies to
tools_used on the session list.
Workflow: summarise the agent's goal
posthog:mcp-analytics-sessions-generate-intent
{ "id": "<session_id>", "date_from": "<session_start>" }
Summarises the ses
常见问题
什么是 MCP 会话?
它是一次智能体运行,由共享同一会话 ID 的所有工具调用按时间顺序组成。
谁来撰写目标摘要?
系统会生成一份 AI 摘要,描述会话的目标,并在第一次请求后保存。
它能找出有错误的会话吗?
可以。它可以列出有错误的会话,对于这种情况会使用自定义 SQL 查询。
详情
作者的原始描述
Investigate individual PostHog MCP sessions — the sequence of tool calls a single agent made in one run, what it was trying to do, and where it went wrong. Use when the user asks "what did this MCP session do?", "show me the tool calls for session X", "what was the agent's goal?", "which sessions had errors?", "who is connecting to my MCP?", or pastes an MCP analytics sessions URL.
repo: PostHog/posthog
热度
- GitHub 星标
- 41k
- 排名
- #6891
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
depot-ci
41k帮你的智能体设置并运行 Depot CI 工作流(GitHub Actions 的替代方案),包括迁移现有工作流和读取运行日志。
depot-container-builds
41k帮你的智能体在 Depot 的远程构建器上构建 Docker 镜像,包括多平台镜像、推送到镜像仓库,以及修复构建失败。
depot-github-runners
41k帮你的智能体把 GitHub Actions 任务迁移到 Depot 托管的运行器上,选择运行器规格和标签,并排查运行器设置问题。
editing-agents-md
41k帮你的智能体判断某条规则应写入 AGENTS.md 还是 CLAUDE.md,并以不会让文件臃肿的方式写下,确保规则真正生效。