From d424c35ee9608a58d50816ee3c4a9c0bb88dec77 Mon Sep 17 00:00:00 2001 From: Georgis Andonis Date: Fri, 25 Sep 2026 17:16:33 +0300 Subject: [PATCH 1/2] fix(mcp): keep conversation_id across later user messages The conversation_id description said to echo the server's previous response. ChatGPT read that as scoped to one message's tool calls and omitted the handle on the first call of each new message, so every message started a new session. The description now says to keep passing the same value for the rest of the conversation, and to pass it unchanged rather than "echo" it. The text matches the TypeScript SDK. Co-Authored-By: Claude Opus 5.5 (1M context) --- .sampo/changesets/persistent-conversation-id.md | 5 +++++ posthog/mcp/constants.py | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .sampo/changesets/persistent-conversation-id.md diff --git a/.sampo/changesets/persistent-conversation-id.md b/.sampo/changesets/persistent-conversation-id.md new file mode 100644 index 000000000..0571bf451 --- /dev/null +++ b/.sampo/changesets/persistent-conversation-id.md @@ -0,0 +1,5 @@ +--- +pypi/posthog: patch +--- + +Tell agents to keep passing the same `conversation_id` across later user messages. The previous wording let ChatGPT treat the handle as scoped to one message's tool calls, so each new message started a new session. diff --git a/posthog/mcp/constants.py b/posthog/mcp/constants.py index 75dff21b8..85f2fed63 100644 --- a/posthog/mcp/constants.py +++ b/posthog/mcp/constants.py @@ -28,8 +28,11 @@ ) DEFAULT_CONVERSATION_ID_DESCRIPTION = ( - "Echo the conversation_id from the server's previous response. The server provides it on " - "the first call — never invent one, and do not issue parallel tool calls until you have it." + "Pass the exact conversation_id from the server's previous response, unchanged. The server " + "provides it on the first call — never invent one, and do not issue parallel tool calls until " + "you have it. Keep passing the same conversation_id for the rest of the conversation, including " + "after later user messages or on a different task; do not reset it when the user starts a new " + "request." ) DEFAULT_MODEL_PARAMETER_DESCRIPTION = ( From 6ae2b3bd2612be70c0bf815cb90731e6626ccd25 Mon Sep 17 00:00:00 2001 From: Georgis Andonis Date: Fri, 25 Sep 2026 17:22:34 +0300 Subject: [PATCH 2/2] chore(mcp): shorten the changeset and guard the persistence wording Matches the TypeScript PR: the changeset is one user-facing line, and the schema unit test asserts the cross-message clause itself, so removing it from the description fails the test. Co-Authored-By: Claude Opus 5.5 (1M context) --- .sampo/changesets/persistent-conversation-id.md | 2 +- posthog/test/mcp/test_units.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.sampo/changesets/persistent-conversation-id.md b/.sampo/changesets/persistent-conversation-id.md index 0571bf451..7164b2d05 100644 --- a/.sampo/changesets/persistent-conversation-id.md +++ b/.sampo/changesets/persistent-conversation-id.md @@ -2,4 +2,4 @@ pypi/posthog: patch --- -Tell agents to keep passing the same `conversation_id` across later user messages. The previous wording let ChatGPT treat the handle as scoped to one message's tool calls, so each new message started a new session. +Keep MCP conversation sessions consistent across user messages. diff --git a/posthog/test/mcp/test_units.py b/posthog/test/mcp/test_units.py index ef122d9fc..2fff89e6a 100644 --- a/posthog/test/mcp/test_units.py +++ b/posthog/test/mcp/test_units.py @@ -230,6 +230,11 @@ def test_add_conversation_id_adds_property(): {"type": "object", "properties": {"x": {"type": "string"}}}, "t" ) assert out["properties"]["conversation_id"]["type"] == "string" + # Without this clause, ChatGPT drops the handle on each new user message and every message becomes its own session. + assert ( + "rest of the conversation, including after later user messages" + in out["properties"]["conversation_id"]["description"] + ) def test_add_conversation_id_skips_when_already_present():