Skip to content

: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.

fix(propdefs): always type $mcp_protocol_version as String (#106358)

Lucas Fariab6aa2611afc7
diff --git a/rust/property-defs-rs/src/types.rs b/rust/property-defs-rs/src/types.rs
index f4f251ae8df6..07cafbb71504 100644
--- a/rust/property-defs-rs/src/types.rs
+++ b/rust/property-defs-rs/src/types.rs
@@ -450,6 +450,12 @@ pub fn detect_property_type(key: &str, value: &Value) -> Option<PropertyValueTyp
return Some(PropertyValueType::String);
}
+ if key == "$mcp_protocol_version" {
+ // MCP protocol revisions are named by date ("2025-11-25") but are identifiers, and some
+ // aren't dates at all ("draft"). As DateTime they read back as midnight timestamps.
+ return Some(PropertyValueType::String);
+ }
+
if key.starts_with("$survey_response") {
// NB: $survey_responses are collected in an interesting way, where the first
// response is called `$survey_response` and subsequent responses are called
diff --git a/rust/property-defs-rs/tests/types.rs b/rust/property-defs-rs/tests/types.rs
index 0ac154f9a03e..5ee36e97ed50 100644
--- a/rust/property-defs-rs/tests/types.rs
+++ b/rust/property-defs-rs/tests/types.rs
@@ -557,6 +557,17 @@ fn test_initial_utm_properties_always_string() {
}
}
+#[rstest]
+#[case(Value::from("2026-07-28"))]
+#[case(Value::from("2025-06-18"))]
+#[case(Value::from("draft"))]
+fn test_mcp_protocol_version_always_string(#[case] value: Value) {
+ assert_eq!(
+ detect_property_type("$mcp_protocol_version", &value),
+ Some(PropertyValueType::String)
+ );
+}
+
#[test]
fn test_bare_utm_properties_still_string() {
// bare utm_* properties must still be classified as String