Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .sampo/changesets/persistent-conversation-id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
pypi/posthog: patch
---

Keep MCP conversation sessions consistent across user messages.
7 changes: 5 additions & 2 deletions posthog/mcp/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
5 changes: 5 additions & 0 deletions posthog/test/mcp/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
Loading