: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(customer-analytics): Custom property definitions table + MCP tools (#67075)
Arthur Moreira de Deus2f23a8897077
diff --git a/posthog/hogql/database/schema/system.py b/posthog/hogql/database/schema/system.pyindex 564fd33e631e..7cc141457779 100644--- a/posthog/hogql/database/schema/system.py+++ b/posthog/hogql/database/schema/system.py@@ -315,6 +315,41 @@ cohorts: PostgresTable = PostgresTable(},)+custom_property_definitions: PostgresTable = PostgresTable(+ name="custom_property_definitions",+ postgres_table_name="customer_analytics_custompropertydefinition",+ # Sub-resource of accounts; gated at the account resource level (see customer_analytics backend CLAUDE.md).+ access_scope="account",+ description="Customer analytics custom property definitions: team-scoped attribute shapes (the property's name and type), one row per definition. Per-account values are exposed via the system.accounts.custom_properties lazy join.",+ fields={+ "id": UUIDDatabaseField(name="id", description="Custom property definition UUID."),+ "team_id": IntegerDatabaseField(name="team_id"),+ "name": StringDatabaseField(+ name="name", description="Human-readable name of the custom property; unique within the team."+ ),+ "description": StringDatabaseField(+ name="description", nullable=True, description="Optional description of what the property represents."+ ),+ "display_type": StringDatabaseField(+ name="display_type",+ description="How the property is interpreted and rendered: 'text', 'number', 'currency', 'percent', 'date', 'datetime', or 'boolean'.",+ ),+ "_is_big_number": BooleanDatabaseField(name="is_big_number", hidden=True),+ "is_big_number": ExpressionField(+ name="is_big_number",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_is_big_number"])]),+ description="1 if large numeric values are abbreviated (e.g. 10,000 -> 10K), 0 otherwise.",+ ),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the definition."+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the definition was created."),+ "updated_at": DateTimeDatabaseField(+ name="updated_at", nullable=True, description="When the definition was last updated."+ ),+ },+)+dashboards: PostgresTable = PostgresTable(name="dashboards",postgres_table_name="posthog_dashboard",@@ -2027,6 +2062,7 @@ class SystemTables(TableNode):"business_knowledge_sources": TableNode(name="business_knowledge_sources", table=business_knowledge_sources),"cohort_calculation_history": TableNode(name="cohort_calculation_history", table=cohort_calculation_history),"cohorts": TableNode(name="cohorts", table=cohorts),+ "custom_property_definitions": TableNode(name="custom_property_definitions", table=custom_property_definitions),"dashboards": TableNode(name="dashboards", table=dashboards),"dashboard_tiles": TableNode(name="dashboard_tiles", table=dashboard_tiles),"data_modeling_jobs": TableNode(name="data_modeling_jobs", table=data_modeling_jobs),diff --git a/posthog/hogql/database/schema/test/test_system_tables.py b/posthog/hogql/database/schema/test/test_system_tables.pyindex 7f028aa10cfc..9372c0a49613 100644--- a/posthog/hogql/database/schema/test/test_system_tables.py+++ b/posthog/hogql/database/schema/test/test_system_tables.py@@ -166,6 +166,10 @@ def _create_account(team: Team, label: str) -> Account:return Account.objects.unscoped().create(team=team, name=f"account_{label}", external_id=f"ext_{label}")+def _create_custom_property_definition(team: Team, label: str) -> "CustomPropertyDefinition":+ return CustomPropertyDefinition.objects.unscoped().create(team=team, name=f"def_{label}", display_type="text")++def _create_action(team: Team, label: str) -> Action:return Action.objects.create(team=team, name=f"action_{label}")@@ -636,6 +640,7 @@ SYSTEM_TABLE_FACTORIES = [("business_knowledge_sources", _create_business_knowledge_source),("cohorts", _create_cohort),("cohort_calculation_history", _create_cohort_calculation_history),+ ("custom_property_definitions", _create_custom_property_definition),("dashboards", _create_dashboard),("dashboard_tiles", _create_dashboard_tile),("data_modeling_jobs", _create_data_modeling_job),diff --git a/posthog/hogql/database/test/__snapshots__/test_database.ambr b/posthog/hogql/database/test/__snapshots__/test_database.ambrindex b1a4c1d5cfb6..0412e1186e96 100644--- a/posthog/hogql/database/test/__snapshots__/test_database.ambr+++ b/posthog/hogql/database/test/__snapshots__/test_database.ambr@@ -3912,6 +3912,94 @@"row_count": null,"type": "system"},+ "system.custom_property_definitions": {+ "fields": {+ "id": {+ "chain": null,+ "fields": null,+ "hogql_value": "id",+ "id": null,+ "name": "id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "name": {+ "chain": null,+ "fields": null,+ "hogql_value": "name",+ "id": null,+ "name": "name",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "description": {+ "chain": null,+ "fields": null,+ "hogql_value": "description",+ "id": null,+ "name": "description",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "display_type": {+ "chain": null,+ "fields": null,+ "hogql_value": "display_type",+ "id": null,+ "name": "display_type",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "is_big_number": {+ "chain": null,+ "fields": null,+ "hogql_value": "is_big_number",+ "id": null,+ "name": "is_big_number",+ "schema_valid": true,+ "table": null,+ "type": "integer"+ },+ "created_by_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "created_by_id",+ "id": null,+ "name": "created_by_id",+ "schema_valid": true,+ "table": null,+ "type": "integer"+ },+ "created_at": {+ "chain": null,+ "fields": null,+ "hogql_value": "created_at",+ "id": null,+ "name": "created_at",+ "schema_valid": true,+ "table": null,+ "type": "datetime"+ },+ "updated_at": {+ "chain": null,+ "fields": null,+ "hogql_value": "updated_at",+ "id": null,+ "name": "updated_at",+ "schema_valid": true,+ "table": null,+ "type": "datetime"+ }+ },+ "id": "system.custom_property_definitions",+ "name": "system.custom_property_definitions",+ "row_count": null,+ "type": "system"+ },"system.dashboards": {"fields": {"id": {@@ -12342,6 +12430,94 @@"row_count": null,"type": "system"},+ "system.custom_property_definitions": {+ "fields": {+ "id": {+ "chain": null,+ "fields": null,+ "hogql_value": "id",+ "id": null,+ "name": "id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "name": {+ "chain": null,+ "fields": null,+ "hogql_value": "name",+ "id": null,+ "name": "name",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "description": {+ "chain": null,+ "fields": null,+ "hogql_value": "description",+ "id": null,+ "name": "description",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "display_type": {+ "chain": null,+ "fields": null,+ "hogql_value": "display_type",+ "id": null,+ "name": "display_type",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "is_big_number": {+ "chain": null,+ "fields": null,+ "hogql_value": "is_big_number",+ "id": null,+ "name": "is_big_number",+ "schema_valid": true,+ "table": null,+ "type": "integer"+ },+ "created_by_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "created_by_id",+ "id": null,+ "name": "created_by_id",+ "schema_valid": true,+ "table": null,+ "type": "integer"+ },+ "created_at": {+ "chain": null,+ "fields": null,+ "hogql_value": "created_at",+ "id": null,+ "name": "created_at",+ "schema_valid": true,+ "table": null,+ "type": "datetime"+ },+ "updated_at": {+ "chain": null,+ "fields": null,+ "hogql_value": "updated_at",+ "id": null,+ "name": "updated_at",+ "schema_valid": true,+ "table": null,+ "type": "datetime"+ }+ },+ "id": "system.custom_property_definitions",+ "name": "system.custom_property_definitions",+ "row_count": null,+ "type": "system"+ },"system.dashboards": {"fields": {"id": {diff --git a/products/customer_analytics/mcp/tools.yaml b/products/customer_analytics/mcp/tools.yamlindex 75cf09bd2d97..a9d1d2433ef6 100644--- a/products/customer_analytics/mcp/tools.yaml+++ b/products/customer_analytics/mcp/tools.yaml@@ -39,10 +39,40 @@ tools:feature_flag: customer-analytics-cspaccounts-custom-property-values-create:operation: accounts_custom_property_values_create- enabled: false+ enabled: true+ scopes:+ - account:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: false+ title: Set account custom property value+ description: >+ Set the value of a custom property for a Customer Analytics account. This is an upsert: it replaces the+ account's current value for the given `definition`, keeping at most one active value per account and+ definition. Pass `definition` (the custom property definition UUID) and `value` matching the definition's+ type — a number for number/currency/percent, a boolean for boolean, an ISO-8601 string for date/datetime, or+ text for text. List or create definitions with `custom-property-definitions-list` and+ `custom-property-definitions-create`.+ feature_flag: customer-analytics-cspaccounts-custom-property-values-list:operation: accounts_custom_property_values_list- enabled: false+ enabled: true+ scopes:+ - account:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ list: true+ title: List account custom property values+ description: >+ List the current custom property values for a single Customer Analytics account. Each result pairs a custom+ property definition (via `definition_id`) with the account's `value` for it — typed per the definition's+ display_type (string, number, boolean, or ISO-8601 datetime) — plus `created_at` and who set it. Only+ current values are returned; superseded history is not. Resolve a `definition_id` to its name and type with+ `custom-property-definitions-list` or `custom-property-definitions-retrieve`.+ feature_flag: customer-analytics-cspaccounts-destroy:operation: accounts_destroyenabled: true@@ -191,19 +221,87 @@ tools:enabled: falsecustom-property-definitions-create:operation: custom_property_definitions_create- enabled: false+ enabled: true+ scopes:+ - account:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: false+ title: Create custom property definition+ description: >+ Create a Customer Analytics custom property definition — the shape of a custom account attribute. Provide+ `name` (required, unique within the team), optional `description`, `display_type` (required; one of text,+ number, currency, percent, date, datetime, boolean), and optional `is_big_number` to abbreviate large+ numeric values (e.g. 10,000 → 10K; only valid for numeric display types). Definitions are team-scoped and+ shared across all accounts; set the value a specific account holds via the account custom property value+ tools.+ feature_flag: customer-analytics-cspcustom-property-definitions-destroy:operation: custom_property_definitions_destroy- enabled: false+ enabled: true+ scopes:+ - account:write+ annotations:+ readOnly: false+ destructive: true+ idempotent: true+ title: Delete custom property definition+ description: >+ Permanently delete a Customer Analytics custom property definition by id. Because values reference the+ definition, deleting it also removes the value every account holds for that property. The definition is+ team-scoped, so this affects all accounts.+ feature_flag: customer-analytics-cspcustom-property-definitions-list:operation: custom_property_definitions_list- enabled: false+ enabled: true+ scopes:+ - account:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ list: true+ title: List custom property definitions+ description: >+ List Customer Analytics custom property definitions for the project. A definition is the shape of a custom+ account attribute — its `name`, optional `description`, `display_type` (one of text, number, currency,+ percent, date, datetime, boolean), and `is_big_number` flag. Definitions are team-scoped and shared across+ all accounts; the value a specific account holds for a definition is managed separately via the account+ custom property value tools. Use `custom-property-definitions-retrieve` to fetch a single definition by id.+ feature_flag: customer-analytics-cspcustom-property-definitions-partial-update:operation: custom_property_definitions_partial_update- enabled: false+ enabled: true+ scopes:+ - account:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: true+ title: Update custom property definition+ description: >+ Update fields on an existing Customer Analytics custom property definition. Accepts a subset of fields;+ unspecified fields are left unchanged. Updatable fields: `name` (must remain unique within the team),+ `description`, `display_type` (one of text, number, currency, percent, date, datetime, boolean), and+ `is_big_number` (only valid for numeric display types).+ feature_flag: customer-analytics-cspcustom-property-definitions-retrieve:operation: custom_property_definitions_retrieve- enabled: false+ enabled: true+ scopes:+ - account:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: Get custom property definition+ description: >+ Fetch a single Customer Analytics custom property definition by id. Returns its `name`, optional+ `description`, `display_type` (one of text, number, currency, percent, date, datetime, boolean), and+ `is_big_number` flag. A definition is the shape of a custom account attribute; the value a specific account+ holds for it is managed separately via the account custom property value tools.+ feature_flag: customer-analytics-cspcustom-property-definitions-update:operation: custom_property_definitions_updateenabled: falsediff --git a/products/posthog_ai/skills/querying-posthog-data/SKILL.md b/products/posthog_ai/skills/querying-posthog-data/SKILL.mdindex 7a0e39311581..e4a96bc604e4 100644--- a/products/posthog_ai/skills/querying-posthog-data/SKILL.md+++ b/products/posthog_ai/skills/querying-posthog-data/SKILL.md@@ -38,6 +38,7 @@ Schema reference for PostHog's core system models, organized by domain:- [Batch exports](./references/models-batch-exports.md)- [Early Access Features](./references/models-early-access-features.md)- [Cohorts & Persons](./references/models-cohorts.md)+- [Customer analytics custom properties (`system.custom_property_definitions`)](./references/models-customer-analytics.md)- [Dashboards, Tiles & Insights](./references/models-dashboards-insights.md)- [Data Warehouse](./references/models-data-warehouse.md)- [Data Modeling Endpoints](./references/models-endpoints.md)diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-customer-analytics.md b/products/posthog_ai/skills/querying-posthog-data/references/models-customer-analytics.mdnew file mode 100644index 000000000000..3f48eaf2ccf7--- /dev/null+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-customer-analytics.md@@ -0,0 +1,64 @@+# Customer analytics custom properties++Custom properties let a team attach typed attributes to customer analytics accounts. A **definition** is the attribute's shape (its name and how it is typed and rendered); the per-account **values** are queried through `system.accounts` (see below). Definitions are team-scoped — one set per team, shared across all accounts.++Prefer the typed `posthog:custom-property-definitions-*` MCP tools for writes; use HogQL for reads and aggregations.++## CustomPropertyDefinition (`system.custom_property_definitions`)++Team-scoped definitions of custom account properties — the attribute side of the model. One row per property.++### Columns++Column | Type | Nullable | Description+`id` | uuid | NOT NULL | Primary key. Use this to read an account's value (see below)+`team_id` | integer | NOT NULL | Team this definition belongs to+`name` | varchar(400) | NOT NULL | Human-readable property name; unique within the team+`description` | text | NULL | Optional description of what the property represents+`display_type` | varchar(20) | NOT NULL | How the value is typed and rendered: `text`, `number`, `currency`, `percent`, `date`, `datetime`, or `boolean`+`is_big_number` | integer | NOT NULL | `1` if large numeric values are abbreviated (e.g. 10,000 -> 10K), `0` otherwise. Only meaningful for numeric display types+`created_by_id` | integer | NULL | User who created the definition+`created_at` | timestamptz | NOT NULL | When the definition was created+`updated_at` | timestamptz | NULL | When the definition was last updated++### Important notes++- `is_big_number` surfaces as an integer (`0`/`1`), not a boolean.+- `display_type` is the rendering hint; effective data type is string for `text`, numeric for `number`/`currency`/`percent`, datetime for `date`/`datetime`, and boolean for `boolean`.++## Reading per-account values (`system.accounts.custom_properties`)++There is no standalone values table. An account's current value for a definition is read through a lazy join on `system.accounts`, keyed by the definition's `id`:++```text+accounts.custom_properties.values.`<definition_id>`+```++The `<definition_id>` is a `system.custom_property_definitions.id` (backtick-quoted, since it is a UUID). Only the current value is returned — superseded (soft-deleted) values are excluded — and it is team-isolated via the accounts row.++## Common query patterns++**List all custom property definitions for a team:**++```sql+SELECT id, name, display_type, is_big_number+FROM system.custom_property_definitions+ORDER BY name+```++**Find numeric definitions:**++```sql+SELECT id, name, display_type+FROM system.custom_property_definitions+WHERE display_type IN ('number', 'currency', 'percent')+ORDER BY name+```++**Read a specific custom property value across accounts** (substitute a real definition id from the query above):++```sql+SELECT id, name, custom_properties.values.`0192f000-0000-7000-8000-000000000000` AS plan_tier+FROM system.accounts+ORDER BY name+```diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 40c2c8b0a345..75bcd127a8d6 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -14,6 +14,36 @@},"feature_flag": "customer-analytics-csp"},+ "accounts-custom-property-values-create": {+ "description": "Set the value of a custom property for a Customer Analytics account. This is an upsert: it replaces the account's current value for the given `definition`, keeping at most one active value per account and definition. Pass `definition` (the custom property definition UUID) and `value` matching the definition's type — a number for number/currency/percent, a boolean for boolean, an ISO-8601 string for date/datetime, or text for text. List or create definitions with `custom-property-definitions-list` and `custom-property-definitions-create`.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "Set account custom property value",+ "title": "Set account custom property value",+ "required_scopes": ["account:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "customer-analytics-csp"+ },+ "accounts-custom-property-values-list": {+ "description": "List the current custom property values for a single Customer Analytics account. Each result pairs a custom property definition (via `definition_id`) with the account's `value` for it — typed per the definition's display_type (string, number, boolean, or ISO-8601 datetime) — plus `created_at` and who set it. Only current values are returned; superseded history is not. Resolve a `definition_id` to its name and type with `custom-property-definitions-list` or `custom-property-definitions-retrieve`.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "List account custom property values",+ "title": "List account custom property values",+ "required_scopes": ["account:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "customer-analytics-csp"+ },"accounts-destroy": {"description": "Permanently delete a Customer Analytics account by id.","category": "Customer analytics",@@ -1715,6 +1745,81 @@"readOnlyHint": false}},+ "custom-property-definitions-create": {+ "description": "Create a Customer Analytics custom property definition — the shape of a custom account attribute. Provide `name` (required, unique within the team), optional `description`, `display_type` (required; one of text, number, currency, percent, date, datetime, boolean), and optional `is_big_number` to abbreviate large numeric values (e.g. 10,000 → 10K; only valid for numeric display types). Definitions are team-scoped and shared across all accounts; set the value a specific account holds via the account custom property value tools.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "Create custom property definition",+ "title": "Create custom property definition",+ "required_scopes": ["account:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "customer-analytics-csp"+ },+ "custom-property-definitions-destroy": {+ "description": "Permanently delete a Customer Analytics custom property definition by id. Because values reference the definition, deleting it also removes the value every account holds for that property. The definition is team-scoped, so this affects all accounts.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "Delete custom property definition",+ "title": "Delete custom property definition",+ "required_scopes": ["account:write"],+ "annotations": {+ "destructiveHint": true,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "customer-analytics-csp"+ },+ "custom-property-definitions-list": {+ "description": "List Customer Analytics custom property definitions for the project. A definition is the shape of a custom account attribute — its `name`, optional `description`, `display_type` (one of text, number, currency, percent, date, datetime, boolean), and `is_big_number` flag. Definitions are team-scoped and shared across all accounts; the value a specific account holds for a definition is managed separately via the account custom property value tools. Use `custom-property-definitions-retrieve` to fetch a single definition by id.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "List custom property definitions",+ "title": "List custom property definitions",+ "required_scopes": ["account:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "customer-analytics-csp"+ },+ "custom-property-definitions-partial-update": {+ "description": "Update fields on an existing Customer Analytics custom property definition. Accepts a subset of fields; unspecified fields are left unchanged. Updatable fields: `name` (must remain unique within the team), `description`, `display_type` (one of text, number, currency, percent, date, datetime, boolean), and `is_big_number` (only valid for numeric display types).",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "Update custom property definition",+ "title": "Update custom property definition",+ "required_scopes": ["account:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "customer-analytics-csp"+ },+ "custom-property-definitions-retrieve": {+ "description": "Fetch a single Customer Analytics custom property definition by id. Returns its `name`, optional `description`, `display_type` (one of text, number, currency, percent, date, datetime, boolean), and `is_big_number` flag. A definition is the shape of a custom account attribute; the value a specific account holds for it is managed separately via the account custom property value tools.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "Get custom property definition",+ "title": "Get custom property definition",+ "required_scopes": ["account:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "customer-analytics-csp"+ },"dashboard-create": {"description": "Create a new dashboard. Provide a name and optional description, tags, and pinned status. Can also create from a template or duplicate an existing dashboard. The returned tiles omit insight results to save context — use dashboard-insights-run to fetch the actual data for each insight. To add widget tiles after creation, see dashboard-widget-catalog-list for available widget types and dashboard-widgets-batch-add to add them.","category": "Dashboards",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex f1ffe783fc14..f2017b9cabac 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -14,6 +14,36 @@},"feature_flag": "customer-analytics-csp"},+ "accounts-custom-property-values-create": {+ "description": "Set the value of a custom property for a Customer Analytics account. This is an upsert: it replaces the account's current value for the given `definition`, keeping at most one active value per account and definition. Pass `definition` (the custom property definition UUID) and `value` matching the definition's type — a number for number/currency/percent, a boolean for boolean, an ISO-8601 string for date/datetime, or text for text. List or create definitions with `custom-property-definitions-list` and `custom-property-definitions-create`.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "Set account custom property value",+ "title": "Set account custom property value",+ "required_scopes": ["account:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "customer-analytics-csp"+ },+ "accounts-custom-property-values-list": {+ "description": "List the current custom property values for a single Customer Analytics account. Each result pairs a custom property definition (via `definition_id`) with the account's `value` for it — typed per the definition's display_type (string, number, boolean, or ISO-8601 datetime) — plus `created_at` and who set it. Only current values are returned; superseded history is not. Resolve a `definition_id` to its name and type with `custom-property-definitions-list` or `custom-property-definitions-retrieve`.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "List account custom property values",+ "title": "List account custom property values",+ "required_scopes": ["account:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "customer-analytics-csp"+ },"accounts-destroy": {"description": "Permanently delete a Customer Analytics account by id.","category": "Customer analytics",@@ -1745,6 +1775,81 @@"readOnlyHint": false}},+ "custom-property-definitions-create": {+ "description": "Create a Customer Analytics custom property definition — the shape of a custom account attribute. Provide `name` (required, unique within the team), optional `description`, `display_type` (required; one of text, number, currency, percent, date, datetime, boolean), and optional `is_big_number` to abbreviate large numeric values (e.g. 10,000 → 10K; only valid for numeric display types). Definitions are team-scoped and shared across all accounts; set the value a specific account holds via the account custom property value tools.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "Create custom property definition",+ "title": "Create custom property definition",+ "required_scopes": ["account:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "customer-analytics-csp"+ },+ "custom-property-definitions-destroy": {+ "description": "Permanently delete a Customer Analytics custom property definition by id. Because values reference the definition, deleting it also removes the value every account holds for that property. The definition is team-scoped, so this affects all accounts.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "Delete custom property definition",+ "title": "Delete custom property definition",+ "required_scopes": ["account:write"],+ "annotations": {+ "destructiveHint": true,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "customer-analytics-csp"+ },+ "custom-property-definitions-list": {+ "description": "List Customer Analytics custom property definitions for the project. A definition is the shape of a custom account attribute — its `name`, optional `description`, `display_type` (one of text, number, currency, percent, date, datetime, boolean), and `is_big_number` flag. Definitions are team-scoped and shared across all accounts; the value a specific account holds for a definition is managed separately via the account custom property value tools. Use `custom-property-definitions-retrieve` to fetch a single definition by id.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "List custom property definitions",+ "title": "List custom property definitions",+ "required_scopes": ["account:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "customer-analytics-csp"+ },+ "custom-property-definitions-partial-update": {+ "description": "Update fields on an existing Customer Analytics custom property definition. Accepts a subset of fields; unspecified fields are left unchanged. Updatable fields: `name` (must remain unique within the team), `description`, `display_type` (one of text, number, currency, percent, date, datetime, boolean), and `is_big_number` (only valid for numeric display types).",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "Update custom property definition",+ "title": "Update custom property definition",+ "required_scopes": ["account:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "customer-analytics-csp"+ },+ "custom-property-definitions-retrieve": {+ "description": "Fetch a single Customer Analytics custom property definition by id. Returns its `name`, optional `description`, `display_type` (one of text, number, currency, percent, date, datetime, boolean), and `is_big_number` flag. A definition is the shape of a custom account attribute; the value a specific account holds for it is managed separately via the account custom property value tools.",+ "category": "Customer analytics",+ "feature": "customer_analytics",+ "summary": "Get custom property definition",+ "title": "Get custom property definition",+ "required_scopes": ["account:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "customer-analytics-csp"+ },"dashboard-create": {"description": "Create a new dashboard. Provide a name and optional description, tags, and pinned status. Can also create from a template or duplicate an existing dashboard. The returned tiles omit insight results to save context — use dashboard-insights-run to fetch the actual data for each insight. To add widget tiles after creation, see dashboard-widget-catalog-list for available widget types and dashboard-widgets-batch-add to add them.","category": "Dashboards",diff --git a/services/mcp/src/generated/customer_analytics/api.ts b/services/mcp/src/generated/customer_analytics/api.tsindex a6b0e5ec0d93..92f979a204ad 100644--- a/services/mcp/src/generated/customer_analytics/api.ts+++ b/services/mcp/src/generated/customer_analytics/api.ts@@ -3,7 +3,7 @@* MCP service uses these Zod schemas for generated tool handlers.* To regenerate: hogli build:openapi*- * PostHog API - MCP 14 enabled ops+ * PostHog API - MCP 21 enabled ops* OpenAPI spec version: 1.0.0*/import * as zod from 'zod'@@ -103,6 +103,33 @@ export const AccountsCreateBody = /* @__PURE__ */ zod}).describe('A Customer Analytics account — a logical grouping used to assign customer-success ownership.')+export const AccountsCustomPropertyValuesListParams = /* @__PURE__ */ zod.object({+ account_id: zod.string().describe('UUID of the parent account.'),+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."+ ),+})++export const AccountsCustomPropertyValuesCreateParams = /* @__PURE__ */ zod.object({+ account_id: zod.string().describe('UUID of the parent account.'),+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."+ ),+})++export const AccountsCustomPropertyValuesCreateBody = /* @__PURE__ */ zod.object({+ definition: zod.string().describe('UUID of the custom property definition whose value to set for this account.'),+ value: zod+ .union([zod.string(), zod.number(), zod.boolean()])+ .describe(+ "Value to store, matching the definition's type: a number for number/currency/percent, a boolean for boolean, an ISO-8601 string for date/datetime, or text for text properties."+ ),+})+export const AccountsNotebooksListParams = /* @__PURE__ */ zod.object({account_id: zod.string().describe('UUID of the parent account.'),project_id: zod@@ -244,6 +271,110 @@ export const AccountsDestroyParams = /* @__PURE__ */ zod.object({),})+export const CustomPropertyDefinitionsListParams = /* @__PURE__ */ zod.object({+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."+ ),+})++export const CustomPropertyDefinitionsListQueryParams = /* @__PURE__ */ zod.object({+ limit: zod.number().optional().describe('Number of results to return per page.'),+ offset: zod.number().optional().describe('The initial index from which to return the results.'),+})++export const CustomPropertyDefinitionsCreateParams = /* @__PURE__ */ zod.object({+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."+ ),+})++export const customPropertyDefinitionsCreateBodyNameMax = 400++export const customPropertyDefinitionsCreateBodyIsBigNumberDefault = false++export const CustomPropertyDefinitionsCreateBody = /* @__PURE__ */ zod+ .object({+ name: zod+ .string()+ .max(customPropertyDefinitionsCreateBodyNameMax)+ .describe('Human-readable name of the custom property. Unique within the team.'),+ description: zod.string().nullish().describe('Optional description of what the property represents.'),+ display_type: zod+ .enum(['text', 'number', 'currency', 'percent', 'date', 'datetime', 'boolean'])+ .describe(+ '* `text` - text\n* `number` - number\n* `currency` - currency\n* `percent` - percent\n* `date` - date\n* `datetime` - datetime\n* `boolean` - boolean'+ )+ .describe(+ "How the property is interpreted and rendered: 'text', 'number', 'currency', 'percent', 'date', 'datetime', or 'boolean'.\n\n* `text` - text\n* `number` - number\n* `currency` - currency\n* `percent` - percent\n* `date` - date\n* `datetime` - datetime\n* `boolean` - boolean"+ ),+ is_big_number: zod+ .boolean()+ .default(customPropertyDefinitionsCreateBodyIsBigNumberDefault)+ .describe('Abbreviate large numbers (e.g. 10,000 → 10K). Only applies to numeric properties.'),+ })+ .describe(+ "A team-scoped definition of a custom account property — the attribute side of the model.\n\nHolds only the property's shape (name, display type, big-number flag). Per-account values are\nstored separately, so this serializer never reads or writes account values. The numeric-only\nbig-number rule and the unique-name conflict are enforced behind the facade."+ )++export const CustomPropertyDefinitionsRetrieveParams = /* @__PURE__ */ zod.object({+ id: zod.string(),+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."+ ),+})++export const CustomPropertyDefinitionsPartialUpdateParams = /* @__PURE__ */ zod.object({+ id: zod.string(),+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."+ ),+})++export const customPropertyDefinitionsPartialUpdateBodyNameMax = 400++export const CustomPropertyDefinitionsPartialUpdateBody = /* @__PURE__ */ zod+ .object({+ name: zod+ .string()+ .max(customPropertyDefinitionsPartialUpdateBodyNameMax)+ .optional()+ .describe('Human-readable name of the custom property. Unique within the team.'),+ description: zod.string().nullish().describe('Optional description of what the property represents.'),+ display_type: zod+ .enum(['text', 'number', 'currency', 'percent', 'date', 'datetime', 'boolean'])+ .describe(+ '* `text` - text\n* `number` - number\n* `currency` - currency\n* `percent` - percent\n* `date` - date\n* `datetime` - datetime\n* `boolean` - boolean'+ )+ .optional()+ .describe(+ "How the property is interpreted and rendered: 'text', 'number', 'currency', 'percent', 'date', 'datetime', or 'boolean'.\n\n* `text` - text\n* `number` - number\n* `currency` - currency\n* `percent` - percent\n* `date` - date\n* `datetime` - datetime\n* `boolean` - boolean"+ ),+ is_big_number: zod+ .boolean()+ .optional()+ .describe('Abbreviate large numbers (e.g. 10,000 → 10K). Only applies to numeric properties.'),+ })+ .describe(+ "A team-scoped definition of a custom account property — the attribute side of the model.\n\nHolds only the property's shape (name, display type, big-number flag). Per-account values are\nstored separately, so this serializer never reads or writes account values. The numeric-only\nbig-number rule and the unique-name conflict are enforced behind the facade."+ )++export const CustomPropertyDefinitionsDestroyParams = /* @__PURE__ */ zod.object({+ id: zod.string(),+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."+ ),+})+export const groupsTypesMetricsListPathGroupTypeIndexMin = -2147483648export const groupsTypesMetricsListPathGroupTypeIndexMax = 2147483647diff --git a/services/mcp/src/tools/generated/customer_analytics.ts b/services/mcp/src/tools/generated/customer_analytics.tsindex 4c5439e1468f..a5beb1a2ccc8 100644--- a/services/mcp/src/tools/generated/customer_analytics.ts+++ b/services/mcp/src/tools/generated/customer_analytics.ts@@ -4,6 +4,9 @@ import { z } from 'zod'import type { Schemas } from '@/api/generated'import {AccountsCreateBody,+ AccountsCustomPropertyValuesCreateBody,+ AccountsCustomPropertyValuesCreateParams,+ AccountsCustomPropertyValuesListParams,AccountsDestroyParams,AccountsListQueryParams,AccountsNotebooksCreateBody,@@ -15,6 +18,12 @@ import {AccountsPartialUpdateBody,AccountsPartialUpdateParams,AccountsRetrieveParams,+ CustomPropertyDefinitionsCreateBody,+ CustomPropertyDefinitionsDestroyParams,+ CustomPropertyDefinitionsListQueryParams,+ CustomPropertyDefinitionsPartialUpdateBody,+ CustomPropertyDefinitionsPartialUpdateParams,+ CustomPropertyDefinitionsRetrieveParams,GroupsTypesMetricsCreateBody,GroupsTypesMetricsCreateParams,GroupsTypesMetricsDestroyParams,@@ -64,6 +73,52 @@ const accountsCreate = (): ToolBase<typeof AccountsCreateSchema, Schemas.Account},})+const AccountsCustomPropertyValuesCreateSchema = AccountsCustomPropertyValuesCreateParams.omit({+ project_id: true,+}).extend(AccountsCustomPropertyValuesCreateBody.shape)++const accountsCustomPropertyValuesCreate = (): ToolBase<+ typeof AccountsCustomPropertyValuesCreateSchema,+ Schemas.CustomPropertyValue+> => ({+ name: 'accounts-custom-property-values-create',+ schema: AccountsCustomPropertyValuesCreateSchema,+ handler: async (context: Context, params: z.infer<typeof AccountsCustomPropertyValuesCreateSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.definition !== undefined) {+ body['definition'] = params.definition+ }+ if (params.value !== undefined) {+ body['value'] = params.value+ }+ const result = await context.api.request<Schemas.CustomPropertyValue>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/accounts/${encodeURIComponent(String(params.account_id))}/custom_property_values/`,+ body,+ })+ return result+ },+})++const AccountsCustomPropertyValuesListSchema = AccountsCustomPropertyValuesListParams.omit({ project_id: true })++const accountsCustomPropertyValuesList = (): ToolBase<+ typeof AccountsCustomPropertyValuesListSchema,+ WithPostHogUrl<Schemas.CustomPropertyValue[]>+> => ({+ name: 'accounts-custom-property-values-list',+ schema: AccountsCustomPropertyValuesListSchema,+ handler: async (context: Context, params: z.infer<typeof AccountsCustomPropertyValuesListSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.CustomPropertyValue[]>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/accounts/${encodeURIComponent(String(params.account_id))}/custom_property_values/`,+ })+ return await withPostHogUrl(context, result, '/customer-analytics')+ },+})+const AccountsDestroySchema = AccountsDestroyParams.omit({ project_id: true })const accountsDestroy = (): ToolBase<typeof AccountsDestroySchema, unknown> => ({@@ -246,6 +301,127 @@ const accountsRetrieve = (): ToolBase<typeof AccountsRetrieveSchema, Schemas.Acc},})+const CustomPropertyDefinitionsCreateSchema = CustomPropertyDefinitionsCreateBody++const customPropertyDefinitionsCreate = (): ToolBase<+ typeof CustomPropertyDefinitionsCreateSchema,+ Schemas.CustomPropertyDefinition+> => ({+ name: 'custom-property-definitions-create',+ schema: CustomPropertyDefinitionsCreateSchema,+ handler: async (context: Context, params: z.infer<typeof CustomPropertyDefinitionsCreateSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.name !== undefined) {+ body['name'] = params.name+ }+ if (params.description !== undefined) {+ body['description'] = params.description+ }+ if (params.display_type !== undefined) {+ body['display_type'] = params.display_type+ }+ if (params.is_big_number !== undefined) {+ body['is_big_number'] = params.is_big_number+ }+ const result = await context.api.request<Schemas.CustomPropertyDefinition>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/custom_property_definitions/`,+ body,+ })+ return result+ },+})++const CustomPropertyDefinitionsDestroySchema = CustomPropertyDefinitionsDestroyParams.omit({ project_id: true })++const customPropertyDefinitionsDestroy = (): ToolBase<typeof CustomPropertyDefinitionsDestroySchema, unknown> => ({+ name: 'custom-property-definitions-destroy',+ schema: CustomPropertyDefinitionsDestroySchema,+ handler: async (context: Context, params: z.infer<typeof CustomPropertyDefinitionsDestroySchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<unknown>({+ method: 'DELETE',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/custom_property_definitions/${encodeURIComponent(String(params.id))}/`,+ })+ return result+ },+})++const CustomPropertyDefinitionsListSchema = CustomPropertyDefinitionsListQueryParams++const customPropertyDefinitionsList = (): ToolBase<+ typeof CustomPropertyDefinitionsListSchema,+ WithPostHogUrl<Schemas.PaginatedCustomPropertyDefinitionList>+> => ({+ name: 'custom-property-definitions-list',+ schema: CustomPropertyDefinitionsListSchema,+ handler: async (context: Context, params: z.infer<typeof CustomPropertyDefinitionsListSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.PaginatedCustomPropertyDefinitionList>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/custom_property_definitions/`,+ query: {+ limit: params.limit,+ offset: params.offset,+ },+ })+ return await withPostHogUrl(context, result, '/customer-analytics')+ },+})++const CustomPropertyDefinitionsPartialUpdateSchema = CustomPropertyDefinitionsPartialUpdateParams.omit({+ project_id: true,+}).extend(CustomPropertyDefinitionsPartialUpdateBody.shape)++const customPropertyDefinitionsPartialUpdate = (): ToolBase<+ typeof CustomPropertyDefinitionsPartialUpdateSchema,+ Schemas.CustomPropertyDefinition+> => ({+ name: 'custom-property-definitions-partial-update',+ schema: CustomPropertyDefinitionsPartialUpdateSchema,+ handler: async (context: Context, params: z.infer<typeof CustomPropertyDefinitionsPartialUpdateSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.name !== undefined) {+ body['name'] = params.name+ }+ if (params.description !== undefined) {+ body['description'] = params.description+ }+ if (params.display_type !== undefined) {+ body['display_type'] = params.display_type+ }+ if (params.is_big_number !== undefined) {+ body['is_big_number'] = params.is_big_number+ }+ const result = await context.api.request<Schemas.CustomPropertyDefinition>({+ method: 'PATCH',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/custom_property_definitions/${encodeURIComponent(String(params.id))}/`,+ body,+ })+ return result+ },+})++const CustomPropertyDefinitionsRetrieveSchema = CustomPropertyDefinitionsRetrieveParams.omit({ project_id: true })++const customPropertyDefinitionsRetrieve = (): ToolBase<+ typeof CustomPropertyDefinitionsRetrieveSchema,+ Schemas.CustomPropertyDefinition+> => ({+ name: 'custom-property-definitions-retrieve',+ schema: CustomPropertyDefinitionsRetrieveSchema,+ handler: async (context: Context, params: z.infer<typeof CustomPropertyDefinitionsRetrieveSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.CustomPropertyDefinition>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/custom_property_definitions/${encodeURIComponent(String(params.id))}/`,+ })+ return result+ },+})+const UsageMetricsCreateSchema = GroupsTypesMetricsCreateParams.omit({ project_id: true }).extend(GroupsTypesMetricsCreateBody.shape).extend({@@ -410,6 +586,8 @@ const usageMetricsRetrieve = (): ToolBase<typeof UsageMetricsRetrieveSchema, Schexport const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'accounts-create': accountsCreate,+ 'accounts-custom-property-values-create': accountsCustomPropertyValuesCreate,+ 'accounts-custom-property-values-list': accountsCustomPropertyValuesList,'accounts-destroy': accountsDestroy,'accounts-list': accountsList,'accounts-notebooks-create': accountsNotebooksCreate,@@ -418,6 +596,11 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'accounts-notebooks-retrieve': accountsNotebooksRetrieve,'accounts-partial-update': accountsPartialUpdate,'accounts-retrieve': accountsRetrieve,+ 'custom-property-definitions-create': customPropertyDefinitionsCreate,+ 'custom-property-definitions-destroy': customPropertyDefinitionsDestroy,+ 'custom-property-definitions-list': customPropertyDefinitionsList,+ 'custom-property-definitions-partial-update': customPropertyDefinitionsPartialUpdate,+ 'custom-property-definitions-retrieve': customPropertyDefinitionsRetrieve,'usage-metrics-create': usageMetricsCreate,'usage-metrics-destroy': usageMetricsDestroy,'usage-metrics-list': usageMetricsList,