: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(data-warehouse): add MCP tools to set up warehouse destinations (#122829)
Daniel RC217e8e51f2eb
diff --git a/products/warehouse_sources/mcp/tools.yaml b/products/warehouse_sources/mcp/tools.yamlindex d113055c9696..81426f63440a 100644--- a/products/warehouse_sources/mcp/tools.yaml+++ b/products/warehouse_sources/mcp/tools.yaml@@ -87,35 +87,6 @@ tools:the connect page, take the newest credential_id for the source type and call 'data-warehouse-source-setup'with {'credential_id': '<uuid>'} in the payload. Stored credentials are single-use — they are deleted assoon as setup consumes them — and expire after 24 hours if never used.- external-data-destinations-list:- operation: external_data_destinations_list- enabled: true- scopes:- - external_data_source:read- annotations:- readOnly: true- destructive: false- idempotent: true- title: List warehouse destinations- description: >- List the places this project's warehouse sources can write synced rows to. The PostHog warehouse is one of- them, and it is where a source writes when nothing else is configured.- feature_flag: warehouse-multi-destination- external-data-destinations-retrieve:- operation: external_data_destinations_retrieve- enabled: true- scopes:- - external_data_source:read- annotations:- readOnly: true- destructive: false- idempotent: true- enrich_url: '{id}'- title: Get a warehouse destination- description: >- Read one warehouse destination, including the target database or schema it writes to. Credentials live on- the linked integration and are never returned here.- feature_flag: warehouse-multi-destinationexternal-data-schemas-cancel:operation: external_data_schemas_cancel_createenabled: true@@ -406,8 +377,32 @@ tools:idempotent: truetitle: Get a source's destinationsdescription: >- Read the destinations every table on this source syncs to. An empty list means the source writes to the- PostHog warehouse only, which is the default for any source nobody configured destinations for.+ Read the destinations every table on this source syncs to, apart from tables with their own override. A+ source nobody configured destinations for writes to the PostHog warehouse by default and reports it here, so+ a list with only the PostHog warehouse can be a default or an explicit choice. An empty list means the+ project has no PostHog warehouse destination yet. Links to paused destinations are not listed.+ feature_flag: warehouse-multi-destination+ external-data-sources-destinations-update:+ operation: external_data_sources_destinations_partial_update+ enabled: true+ scopes:+ - external_data_source:write+ annotations:+ readOnly: false+ destructive: true+ idempotent: true+ title: Set a source's destinations+ description: >+ Replace the destinations every table on this source syncs to. Tables with their own destination override+ keep it. Pass the full list: a destination left out is detached from the source. A source can also hold a+ link to a paused destination that external-data-sources-destinations-retrieve does not list, and this call+ deletes that link for good. So do not call it while any destination in external-data-destinations-list has+ status paused. Otherwise, before external-data-destinations-add-sources, call this with the list that+ retrieve returned when it holds only the PostHog warehouse: that turns the default into an explicit link, so+ the source keeps updating its PostHog tables.+ param_overrides:+ destination_ids:+ description: The full list of destination ids for this source, at least one. A destination left out is detached.feature_flag: warehouse-multi-destinationexternal-data-sources-destroy:operation: external_data_sources_destroydiff --git a/products/warehouse_sources/mcp/warehouse_destinations.yaml b/products/warehouse_sources/mcp/warehouse_destinations.yamlnew file mode 100644index 000000000000..7512733e024c--- /dev/null+++ b/products/warehouse_sources/mcp/warehouse_destinations.yaml@@ -0,0 +1,124 @@+# MCP tool definitions. Tools are opt-in: an operation is exposed only when it has an entry here.+# List operations without an entry: pnpm --filter=@posthog/mcp run scaffold-yaml -- --candidates --product warehouse_sources+# Add one: pnpm --filter=@posthog/mcp run scaffold-yaml -- --add <operationId> --product warehouse_sources --file ../../products/warehouse_sources/mcp/warehouse_destinations.yaml+# To keep an operation off on purpose, set enabled: false and give a disabled_reason.+category: Warehouse destinations+feature: warehouse_sources+url_prefix: /data-management/warehouse-destinations+ui_apps: {}+tools:+ external-data-destinations-add-sources:+ operation: external_data_destinations_add_sources_create+ enabled: true+ scopes:+ - external_data_source:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: true+ enrich_url: ?destination={params.id}+ title: Attach sources to a warehouse destination+ description: >+ Attach up to 50 existing sources to a destination. Each source's tables then also sync there, except tables+ with their own destination override: they keep the override and ignore this link. Before attaching, check+ the destination's status with external-data-destinations-retrieve: do not attach to a failing or paused+ destination until the user fixed it. Then call external-data-sources-destinations-retrieve for each source.+ When destination_ids holds only the PostHog warehouse destination (is_posthog_warehouse in+ external-data-destinations-list), the source may write there by default and would stop updating its PostHog+ tables after this call. If the user wants to keep them and no destination in external-data-destinations-list+ is paused, first call external-data-sources-destinations-update with that same list: it makes the warehouse+ an explicit link. If a destination is paused, tell the user instead. When destination_ids is empty, tell the+ user the PostHog tables stop updating. Call external-data-schemas-destinations-retrieve for each of the+ source's tables and tell the user which have inherits_from_source false: those will not reach this+ destination. Sources already attached, or already at the destination limit, come back in skipped with a+ reason. An attached source sends only rows from its next syncs, so the destination holds no history until+ those tables are resynced. Set resync=true to start a full resync of every enabled table now, including+ tables with an override that will not reach this destination. Tell the user first: a resync re-reads every+ row and bills every destination the source writes to.+ feature_flag: warehouse-multi-destination+ external-data-destinations-connect-link:+ operation: external_data_destinations_connect_link_retrieve+ enabled: true+ scopes:+ - external_data_source:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: Get a secure connect link for a destination+ description: >+ First step to add a warehouse destination (Postgres, Redshift, Snowflake, BigQuery, Databricks, S3 or Azure+ Blob). Returns a browser link where the user enters the credentials in PostHog, plus the next steps in+ `instructions`. For S3-compatible storage (MinIO, Wasabi, R2, GCS), pass integration_kind='s3-compatible'.+ Never ask the user to paste passwords, keys or tokens into the chat.+ feature_flag: warehouse-multi-destination+ external-data-destinations-create:+ operation: external_data_destinations_create+ enabled: true+ scopes:+ - external_data_source:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: false+ enrich_url: ?destination={id}+ title: Create a warehouse destination+ description: >+ Create a place where warehouse sources write synced rows, from an integration that holds the credentials.+ Get the integration id with external-data-destinations-connect-link first. Pass type, a name, the+ integration id and the target config for the type: Postgres and Redshift take database and schema; Snowflake+ takes database, schema, warehouse and optional role; BigQuery takes dataset and optional project; Databricks+ takes http_path, catalog, schema and volume; S3 takes bucket, region and optional prefix and compression;+ Azure Blob takes container_name and optional prefix and compression. Every type except Redshift tests the+ connection on create, and a failed test returns a 400 that names the field to fix. Redshift has no test, so+ a wrong target only shows up when the first sync fails. The target cannot change after creation, so confirm+ it with the user first. A new destination receives nothing until a source is attached with+ external-data-destinations-add-sources.+ feature_flag: warehouse-multi-destination+ external-data-destinations-list:+ operation: external_data_destinations_list+ enabled: true+ scopes:+ - external_data_source:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: List warehouse destinations+ description: >+ List the places this project's warehouse sources can write synced rows to. The PostHog warehouse is one of+ them, and it is where a source writes when nothing else is configured.+ feature_flag: warehouse-multi-destination+ external-data-destinations-retrieve:+ operation: external_data_destinations_retrieve+ enabled: true+ scopes:+ - external_data_source:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ enrich_url: ?destination={id}+ title: Get a warehouse destination+ description: >+ Read one warehouse destination, including the target database or schema it writes to. Credentials live on+ the linked integration and are never returned here.+ feature_flag: warehouse-multi-destination+ external-data-destinations-test-connection:+ operation: external_data_destinations_test_connection_create+ enabled: true+ scopes:+ - external_data_source:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: true+ title: Test a warehouse destination's connection+ description: >+ Run the connection test for an existing destination and return each step with its result. The test stops at+ the first failed step, and that step's message says what to fix. Redshift has no connection test and returns+ a 400: relay latest_error from external-data-destinations-retrieve instead. The test only reports: a paused+ destination stays paused even when the test passes. It turns back on when the user fixes the problem and+ saves the destination on the warehouse destinations page (the link from+ external-data-destinations-retrieve).+ feature_flag: warehouse-multi-destinationdiff --git a/products/warehouse_sources/skills/setting-up-a-data-warehouse-source/SKILL.md b/products/warehouse_sources/skills/setting-up-a-data-warehouse-source/SKILL.mdindex e6d66331ef9b..a5d56edea3d9 100644--- a/products/warehouse_sources/skills/setting-up-a-data-warehouse-source/SKILL.md+++ b/products/warehouse_sources/skills/setting-up-a-data-warehouse-source/SKILL.md@@ -5,7 +5,8 @@ description: >Salesforce, BigQuery, Snowflake, and so on. Use when the user wants to "connect Stripe", "import data fromPostgres", "add a new data source", "sync my warehouse tables", or wants to pick sync methods for each table. Walksthrough source-type discovery, credential validation, table discovery, per-table sync_type selection, and the- final create call. Also covers picking a good prefix and what to do right after creation.+ final create call. Also covers picking a good prefix, what to do right after creation, and sending a source's+ tables to the user's own warehouse (Snowflake, BigQuery, Postgres, S3 and other destinations).---# Setting up a data warehouse source@@ -40,6 +41,12 @@ hand-pick which tables sync or set non-default sync types per table.| `external-data-sources-update-webhook-inputs-create` | Supply the signing secret manually when auto-registration failed || `external-data-sources-list` | After creation, confirm the source is listed and see its initial status || `external-data-schemas-list` | See per-table sync status once the source is created |+| `external-data-destinations-list` | See existing destinations, including the PostHog warehouse |+| `external-data-destinations-connect-link` | Secure browser link where the user enters a destination's credentials; returns nothing secret |+| `external-data-destinations-create` | Create a destination from the integration the connect page saved |+| `external-data-destinations-add-sources` | Attach existing sources to a destination |+| `external-data-sources-destinations-update` | Set a source's full destination list, for example to keep the PostHog warehouse before attaching |+| `external-data-destinations-test-connection` | Diagnose a destination that is failing or paused (does not resume it) |## Pre-flight: credential gotchas that cause most failures@@ -328,6 +335,44 @@ If the user wants near-real-time replication from Postgres:3. Once prerequisites pass, proceed to db-schema and create. Set `sync_type: "cdc"` on the tables that need it, andinclude `primary_key_columns` for each (CDC requires them).+## Sending a source to the user's own warehouse (optional, when requested)++Only do this when the user asks for their data in their own Snowflake, BigQuery, Postgres, Redshift, Databricks, S3 or+Azure Blob storage. These tools exist only when the feature is on for the project.++1. Call `external-data-destinations-list` first. If a destination for that target already exists, reuse it, but only+ when its `status` is `healthy`. A `failing` or `paused` one needs fixing first (see the end of this section).+2. Call `external-data-destinations-connect-link` with the `destination_type` (for S3-compatible storage such as R2 or+ MinIO, also pass `integration_kind: "s3-compatible"`). Share `connect_url` and wait until the user says they are+ done. The page saves an integration and shows its id.+3. Ask the user for the id the page showed. If they cannot give it, call `integrations-list` with the returned+ `integration_kind` and take the entry with the latest `created_at` (the list is oldest first). Confirm its+ `display_name` with the user before you use it.+4. Ask the user for the target (database and schema, dataset, bucket and prefix, and so on), then call+ `external-data-destinations-create` with `type`, `name`, `integration` and `config`. Creation tests the+ connection for every type except Redshift, and a 400 names the field to fix. A wrong Redshift target only shows up+ when the first sync fails. The target cannot change later, so confirm it before creating.+5. Before you attach a source, check two things and tell the user what you find:+ - Call `external-data-sources-destinations-retrieve`. When `destination_ids` holds only the PostHog warehouse+ destination (`is_posthog_warehouse` in `external-data-destinations-list`), the source may write there by+ default, and attaching would stop its PostHog tables updating. If the user wants to keep them, call+ `external-data-sources-destinations-update` with that same list before step 6: it makes the warehouse an+ explicit link. Skip that call while any destination in `external-data-destinations-list` is paused, because it+ would delete a hidden link to that destination. Tell the user instead. When `destination_ids` is empty, tell+ the user the PostHog tables stop updating.+ - Tables with their own destination override keep it and ignore the new source link. Call+ `external-data-schemas-destinations-retrieve` for the source's tables. Those with `inherits_from_source: false`+ will not reach the new destination.+6. Call `external-data-destinations-add-sources` with the source ids. A source that has already synced sends only+ new rows to the destination. Offer `resync: true` to copy the history, and say that a resync re-reads every row+ (including overridden tables that do not reach the new destination) and bills every destination the source+ writes to.++If a destination shows `status: "failing"` or `"paused"`, run `external-data-destinations-test-connection` and relay+the message of the first failed step. Redshift has no test: relay `latest_error` from+`external-data-destinations-retrieve` instead. The test only reports. A paused destination stays paused until the user+fixes the problem and saves it on the warehouse destinations page.+## Important notes- **Always validate creds with db-schema before create.** The create endpoint will accept invalid creds and then fail@@ -340,7 +385,7 @@ If the user wants near-real-time replication from Postgres:- **A new source syncs to the PostHog warehouse.** That is the default and it needs no setup: a source nobodyconfigured destinations for writes here and nowhere else. Some projects can also send a source's tables to theirown database (`external-data-sources-destinations-retrieve` shows where a source writes, when the feature is on for- the project). Setting that up is a separate step and never something to do as part of creating a source — adding a+ the project). Setting that up is a separate step (see "Sending a source to the user's own warehouse") and never something to do as part of creating a source — adding adestination to a source that has already synced leaves it holding none of the history until the tables are resynced,and a resync bills every destination the source writes to.- **Prefix is load-bearing.** It's part of every HogQL query the user will ever write against these tables. Pickdiff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex a7952e2a7ddd..687992ebcb7d 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -6252,9 +6252,57 @@},"feature_flag": "experiment-behavior-comparison"},+ "external-data-destinations-add-sources": {+ "description": "Attach up to 50 existing sources to a destination. Each source's tables then also sync there, except tables with their own destination override: they keep the override and ignore this link. Before attaching, check the destination's status with external-data-destinations-retrieve: do not attach to a failing or paused destination until the user fixed it. Then call external-data-sources-destinations-retrieve for each source. When destination_ids holds only the PostHog warehouse destination (is_posthog_warehouse in external-data-destinations-list), the source may write there by default and would stop updating its PostHog tables after this call. If the user wants to keep them and no destination in external-data-destinations-list is paused, first call external-data-sources-destinations-update with that same list: it makes the warehouse an explicit link. If a destination is paused, tell the user instead. When destination_ids is empty, tell the user the PostHog tables stop updating. Call external-data-schemas-destinations-retrieve for each of the source's tables and tell the user which have inherits_from_source false: those will not reach this destination. Sources already attached, or already at the destination limit, come back in skipped with a reason. An attached source sends only rows from its next syncs, so the destination holds no history until those tables are resynced. Set resync=true to start a full resync of every enabled table now, including tables with an override that will not reach this destination. Tell the user first: a resync re-reads every row and bills every destination the source writes to.",+ "category": "Warehouse destinations",+ "feature": "warehouse_sources",+ "summary": "Attach sources to a warehouse destination",+ "title": "Attach sources to a warehouse destination",+ "required_scopes": ["external_data_source:write"],+ "api_operations": ["POST /api/projects/{project_id}/external_data_destinations/{id}/add_sources/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "warehouse-multi-destination"+ },+ "external-data-destinations-connect-link": {+ "description": "First step to add a warehouse destination (Postgres, Redshift, Snowflake, BigQuery, Databricks, S3 or Azure Blob). Returns a browser link where the user enters the credentials in PostHog, plus the next steps in `instructions`. For S3-compatible storage (MinIO, Wasabi, R2, GCS), pass integration_kind='s3-compatible'. Never ask the user to paste passwords, keys or tokens into the chat.",+ "category": "Warehouse destinations",+ "feature": "warehouse_sources",+ "summary": "Get a secure connect link for a destination",+ "title": "Get a secure connect link for a destination",+ "required_scopes": ["external_data_source:read"],+ "api_operations": ["GET /api/projects/{project_id}/external_data_destinations/connect_link/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "warehouse-multi-destination"+ },+ "external-data-destinations-create": {+ "description": "Create a place where warehouse sources write synced rows, from an integration that holds the credentials. Get the integration id with external-data-destinations-connect-link first. Pass type, a name, the integration id and the target config for the type: Postgres and Redshift take database and schema; Snowflake takes database, schema, warehouse and optional role; BigQuery takes dataset and optional project; Databricks takes http_path, catalog, schema and volume; S3 takes bucket, region and optional prefix and compression; Azure Blob takes container_name and optional prefix and compression. Every type except Redshift tests the connection on create, and a failed test returns a 400 that names the field to fix. Redshift has no test, so a wrong target only shows up when the first sync fails. The target cannot change after creation, so confirm it with the user first. A new destination receives nothing until a source is attached with external-data-destinations-add-sources.",+ "category": "Warehouse destinations",+ "feature": "warehouse_sources",+ "summary": "Create a warehouse destination",+ "title": "Create a warehouse destination",+ "required_scopes": ["external_data_source:write"],+ "api_operations": ["POST /api/projects/{project_id}/external_data_destinations/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "warehouse-multi-destination"+ },"external-data-destinations-list": {"description": "List the places this project's warehouse sources can write synced rows to. The PostHog warehouse is one of them, and it is where a source writes when nothing else is configured.",- "category": "Warehouse sources",+ "category": "Warehouse destinations","feature": "warehouse_sources","summary": "List warehouse destinations","title": "List warehouse destinations",@@ -6270,7 +6318,7 @@},"external-data-destinations-retrieve": {"description": "Read one warehouse destination, including the target database or schema it writes to. Credentials live on the linked integration and are never returned here.",- "category": "Warehouse sources",+ "category": "Warehouse destinations","feature": "warehouse_sources","summary": "Get a warehouse destination","title": "Get a warehouse destination",@@ -6284,6 +6332,22 @@},"feature_flag": "warehouse-multi-destination"},+ "external-data-destinations-test-connection": {+ "description": "Run the connection test for an existing destination and return each step with its result. The test stops at the first failed step, and that step's message says what to fix. Redshift has no connection test and returns a 400: relay latest_error from external-data-destinations-retrieve instead. The test only reports: a paused destination stays paused even when the test passes. It turns back on when the user fixes the problem and saves the destination on the warehouse destinations page (the link from external-data-destinations-retrieve).",+ "category": "Warehouse destinations",+ "feature": "warehouse_sources",+ "summary": "Test a warehouse destination's connection",+ "title": "Test a warehouse destination's connection",+ "required_scopes": ["external_data_source:write"],+ "api_operations": ["POST /api/projects/{project_id}/external_data_destinations/{id}/test_connection/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "warehouse-multi-destination"+ },"external-data-schemas-cancel": {"description": "Cancel a currently running sync job for a specific table schema. If no sync is running, returns an error. Use 'external-data-schemas-list' to check which schemas have status 'Running' before calling this.","category": "Warehouse sources",@@ -6511,7 +6575,7 @@}},"external-data-sources-destinations-retrieve": {- "description": "Read the destinations every table on this source syncs to. An empty list means the source writes to the PostHog warehouse only, which is the default for any source nobody configured destinations for.",+ "description": "Read the destinations every table on this source syncs to, apart from tables with their own override. A source nobody configured destinations for writes to the PostHog warehouse by default and reports it here, so a list with only the PostHog warehouse can be a default or an explicit choice. An empty list means the project has no PostHog warehouse destination yet. Links to paused destinations are not listed.","category": "Warehouse sources","feature": "warehouse_sources","summary": "Get a source's destinations",@@ -6526,6 +6590,22 @@},"feature_flag": "warehouse-multi-destination"},+ "external-data-sources-destinations-update": {+ "description": "Replace the destinations every table on this source syncs to. Tables with their own destination override keep it. Pass the full list: a destination left out is detached from the source. A source can also hold a link to a paused destination that external-data-sources-destinations-retrieve does not list, and this call deletes that link for good. So do not call it while any destination in external-data-destinations-list has status paused. Otherwise, before external-data-destinations-add-sources, call this with the list that retrieve returned when it holds only the PostHog warehouse: that turns the default into an explicit link, so the source keeps updating its PostHog tables.",+ "category": "Warehouse sources",+ "feature": "warehouse_sources",+ "summary": "Set a source's destinations",+ "title": "Set a source's destinations",+ "required_scopes": ["external_data_source:write"],+ "api_operations": ["PATCH /api/projects/{project_id}/external_data_sources/{id}/destinations/"],+ "annotations": {+ "destructiveHint": true,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "warehouse-multi-destination"+ },"external-data-sources-destroy": {"description": "Delete a data warehouse source and all its table schemas, synced tables, and sync schedules. This is a soft delete. Any running syncs are cancelled first. This cannot be undone — the source must be recreated to resume syncing.","category": "Warehouse sources",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 0cca6a023cf9..3f09a9ffd80b 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -6370,9 +6370,57 @@"readOnlyHint": true}},+ "external-data-destinations-add-sources": {+ "description": "Attach up to 50 existing sources to a destination. Each source's tables then also sync there, except tables with their own destination override: they keep the override and ignore this link. Before attaching, check the destination's status with external-data-destinations-retrieve: do not attach to a failing or paused destination until the user fixed it. Then call external-data-sources-destinations-retrieve for each source. When destination_ids holds only the PostHog warehouse destination (is_posthog_warehouse in external-data-destinations-list), the source may write there by default and would stop updating its PostHog tables after this call. If the user wants to keep them and no destination in external-data-destinations-list is paused, first call external-data-sources-destinations-update with that same list: it makes the warehouse an explicit link. If a destination is paused, tell the user instead. When destination_ids is empty, tell the user the PostHog tables stop updating. Call external-data-schemas-destinations-retrieve for each of the source's tables and tell the user which have inherits_from_source false: those will not reach this destination. Sources already attached, or already at the destination limit, come back in skipped with a reason. An attached source sends only rows from its next syncs, so the destination holds no history until those tables are resynced. Set resync=true to start a full resync of every enabled table now, including tables with an override that will not reach this destination. Tell the user first: a resync re-reads every row and bills every destination the source writes to.",+ "category": "Warehouse destinations",+ "feature": "warehouse_sources",+ "summary": "Attach sources to a warehouse destination",+ "title": "Attach sources to a warehouse destination",+ "required_scopes": ["external_data_source:write"],+ "api_operations": ["POST /api/projects/{project_id}/external_data_destinations/{id}/add_sources/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "warehouse-multi-destination"+ },+ "external-data-destinations-connect-link": {+ "description": "First step to add a warehouse destination (Postgres, Redshift, Snowflake, BigQuery, Databricks, S3 or Azure Blob). Returns a browser link where the user enters the credentials in PostHog, plus the next steps in `instructions`. For S3-compatible storage (MinIO, Wasabi, R2, GCS), pass integration_kind='s3-compatible'. Never ask the user to paste passwords, keys or tokens into the chat.",+ "category": "Warehouse destinations",+ "feature": "warehouse_sources",+ "summary": "Get a secure connect link for a destination",+ "title": "Get a secure connect link for a destination",+ "required_scopes": ["external_data_source:read"],+ "api_operations": ["GET /api/projects/{project_id}/external_data_destinations/connect_link/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "warehouse-multi-destination"+ },+ "external-data-destinations-create": {+ "description": "Create a place where warehouse sources write synced rows, from an integration that holds the credentials. Get the integration id with external-data-destinations-connect-link first. Pass type, a name, the integration id and the target config for the type: Postgres and Redshift take database and schema; Snowflake takes database, schema, warehouse and optional role; BigQuery takes dataset and optional project; Databricks takes http_path, catalog, schema and volume; S3 takes bucket, region and optional prefix and compression; Azure Blob takes container_name and optional prefix and compression. Every type except Redshift tests the connection on create, and a failed test returns a 400 that names the field to fix. Redshift has no test, so a wrong target only shows up when the first sync fails. The target cannot change after creation, so confirm it with the user first. A new destination receives nothing until a source is attached with external-data-destinations-add-sources.",+ "category": "Warehouse destinations",+ "feature": "warehouse_sources",+ "summary": "Create a warehouse destination",+ "title": "Create a warehouse destination",+ "required_scopes": ["external_data_source:write"],+ "api_operations": ["POST /api/projects/{project_id}/external_data_destinations/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "warehouse-multi-destination"+ },"external-data-destinations-list": {"description": "List the places this project's warehouse sources can write synced rows to. The PostHog warehouse is one of them, and it is where a source writes when nothing else is configured.",- "category": "Warehouse sources",+ "category": "Warehouse destinations","feature": "warehouse_sources","summary": "List warehouse destinations","title": "List warehouse destinations",@@ -6388,7 +6436,7 @@},"external-data-destinations-retrieve": {"description": "Read one warehouse destination, including the target database or schema it writes to. Credentials live on the linked integration and are never returned here.",- "category": "Warehouse sources",+ "category": "Warehouse destinations","feature": "warehouse_sources","summary": "Get a warehouse destination","title": "Get a warehouse destination",@@ -6402,6 +6450,22 @@},"feature_flag": "warehouse-multi-destination"},+ "external-data-destinations-test-connection": {+ "description": "Run the connection test for an existing destination and return each step with its result. The test stops at the first failed step, and that step's message says what to fix. Redshift has no connection test and returns a 400: relay latest_error from external-data-destinations-retrieve instead. The test only reports: a paused destination stays paused even when the test passes. It turns back on when the user fixes the problem and saves the destination on the warehouse destinations page (the link from external-data-destinations-retrieve).",+ "category": "Warehouse destinations",+ "feature": "warehouse_sources",+ "summary": "Test a warehouse destination's connection",+ "title": "Test a warehouse destination's connection",+ "required_scopes": ["external_data_source:write"],+ "api_operations": ["POST /api/projects/{project_id}/external_data_destinations/{id}/test_connection/"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "warehouse-multi-destination"+ },"external-data-schemas-cancel": {"description": "Cancel a currently running sync job for a specific table schema. If no sync is running, returns an error. Use 'external-data-schemas-list' to check which schemas have status 'Running' before calling this.","category": "Warehouse sources",@@ -6643,7 +6707,7 @@}},"external-data-sources-destinations-retrieve": {- "description": "Read the destinations every table on this source syncs to. An empty list means the source writes to the PostHog warehouse only, which is the default for any source nobody configured destinations for.",+ "description": "Read the destinations every table on this source syncs to, apart from tables with their own override. A source nobody configured destinations for writes to the PostHog warehouse by default and reports it here, so a list with only the PostHog warehouse can be a default or an explicit choice. An empty list means the project has no PostHog warehouse destination yet. Links to paused destinations are not listed.","category": "Warehouse sources","feature": "warehouse_sources","summary": "Get a source's destinations",@@ -6658,6 +6722,22 @@},"feature_flag": "warehouse-multi-destination"},+ "external-data-sources-destinations-update": {+ "description": "Replace the destinations every table on this source syncs to. Tables with their own destination override keep it. Pass the full list: a destination left out is detached from the source. A source can also hold a link to a paused destination that external-data-sources-destinations-retrieve does not list, and this call deletes that link for good. So do not call it while any destination in external-data-destinations-list has status paused. Otherwise, before external-data-destinations-add-sources, call this with the list that retrieve returned when it holds only the PostHog warehouse: that turns the default into an explicit link, so the source keeps updating its PostHog tables.",+ "category": "Warehouse sources",+ "feature": "warehouse_sources",+ "summary": "Set a source's destinations",+ "title": "Set a source's destinations",+ "required_scopes": ["external_data_source:write"],+ "api_operations": ["PATCH /api/projects/{project_id}/external_data_sources/{id}/destinations/"],+ "annotations": {+ "destructiveHint": true,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "warehouse-multi-destination"+ },"external-data-sources-destroy": {"description": "Delete a data warehouse source and all its table schemas, synced tables, and sync schedules. This is a soft delete. Any running syncs are cancelled first. This cannot be undone — the source must be recreated to resume syncing.","category": "Warehouse sources",diff --git a/services/mcp/src/generated/warehouse_destinations/api.ts b/services/mcp/src/generated/warehouse_destinations/api.tsnew file mode 100644index 000000000000..0c53404391ed--- /dev/null+++ b/services/mcp/src/generated/warehouse_destinations/api.ts@@ -0,0 +1,157 @@+/**+ * Auto-generated from the Django backend OpenAPI schema.+ * MCP service uses these Zod schemas for generated tool handlers.+ * To regenerate: hogli build:openapi+ *+ * PostHog API - MCP 6 enabled ops+ * OpenAPI spec version: 1.0.0+ */+import * as zod from 'zod'++/**+ * Manage where warehouse sources write their synced rows.+ *+ * A destination can be attached to several sources, or to a single table on a source.+ * Credentials come from an integration, so one connection can be reused across syncs.+ */+export const ExternalDataDestinationsListParams = () => 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 ExternalDataDestinationsListQueryParams = () => 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.'),+})++/**+ * Manage where warehouse sources write their synced rows.+ *+ * A destination can be attached to several sources, or to a single table on a source.+ * Credentials come from an integration, so one connection can be reused across syncs.+ */+export const ExternalDataDestinationsCreateParams = () => 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 externalDataDestinationsCreateBodyNameMax = 400++export const ExternalDataDestinationsCreateBody = () => zod.object({+ type: zod+ .enum(['PostHogWarehouse', 'Redshift', 'Snowflake', 'BigQuery', 'Postgres', 'Databricks', 'AzureBlob', 'S3'])+ .describe(+ '\* `PostHogWarehouse` - PostHog warehouse\n\* `Redshift` - Redshift\n\* `Snowflake` - Snowflake\n\* `BigQuery` - BigQuery\n\* `Postgres` - Postgres\n\* `Databricks` - Databricks\n\* `AzureBlob` - Azure Blob\n\* `S3` - S3'+ )+ .describe(+ 'Where synced rows are written. The PostHog warehouse is managed for you, so you cannot create one here.\n\n\* `PostHogWarehouse` - PostHog warehouse\n\* `Redshift` - Redshift\n\* `Snowflake` - Snowflake\n\* `BigQuery` - BigQuery\n\* `Postgres` - Postgres\n\* `Databricks` - Databricks\n\* `AzureBlob` - Azure Blob\n\* `S3` - S3'+ ),+ name: zod+ .string()+ .max(externalDataDestinationsCreateBodyNameMax)+ .describe('Human-readable name shown when picking destinations for a source or table.'),+ config: zod+ .unknown()+ .optional()+ .describe(+ 'Settings for this destination: target database, schema or dataset, bucket and prefix, file format. Credentials are not stored here. They live on the linked integration.'+ ),+ integration: zod+ .number()+ .nullish()+ .describe(+ "Integration holding this destination's credentials. Required for every type except the PostHog warehouse."+ ),+})++/**+ * Manage where warehouse sources write their synced rows.+ *+ * A destination can be attached to several sources, or to a single table on a source.+ * Credentials come from an integration, so one connection can be reused across syncs.+ */+export const ExternalDataDestinationsRetrieveParams = () => zod.object({+ id: zod.string().describe('A UUID string identifying this external data destination.'),+ 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\/."+ ),+})++/**+ * Manage where warehouse sources write their synced rows.+ *+ * A destination can be attached to several sources, or to a single table on a source.+ * Credentials come from an integration, so one connection can be reused across syncs.+ */+export const ExternalDataDestinationsAddSourcesCreateParams = () => zod.object({+ id: zod.string().describe('A UUID string identifying this external data destination.'),+ 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 externalDataDestinationsAddSourcesCreateBodySourceIdsMax = 50++export const externalDataDestinationsAddSourcesCreateBodyResyncDefault = false++export const ExternalDataDestinationsAddSourcesCreateBody = () => zod.object({+ source_ids: zod+ .array(zod.string())+ .max(externalDataDestinationsAddSourcesCreateBodySourceIdsMax)+ .describe('IDs of up to 50 existing sources to attach to this destination.'),+ resync: zod+ .boolean()+ .default(externalDataDestinationsAddSourcesCreateBodyResyncDefault)+ .describe('Start a full resync for each enabled table newly attached.'),+})++/**+ * Test the credentials and target of an existing destination, and return the result of each step.+ */+export const ExternalDataDestinationsTestConnectionCreateParams = () => zod.object({+ id: zod.string().describe('A UUID string identifying this external data destination.'),+ 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\/."+ ),+})++/**+ * Return a secure browser link where the user connects the credentials for a destination.+ *+ * The page saves an integration and does not create the destination, so secrets never pass+ * through the agent. The agent then creates the destination with the new integration's id.+ */+export const ExternalDataDestinationsConnectLinkRetrieveParams = () => 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 ExternalDataDestinationsConnectLinkRetrieveQueryParams = () => zod.object({+ destination_type: zod+ .enum(['Redshift', 'Snowflake', 'BigQuery', 'Postgres', 'Databricks', 'AzureBlob', 'S3'])+ .describe(+ "The destination type to connect, e.g. 'Snowflake' or 'S3'.\n\n\* `Redshift` - Redshift\n\* `Snowflake` - Snowflake\n\* `BigQuery` - BigQuery\n\* `Postgres` - Postgres\n\* `Databricks` - Databricks\n\* `AzureBlob` - Azure Blob\n\* `S3` - S3"+ ),+ integration_kind: zod+ .string()+ .min(1)+ .optional()+ .describe(+ "Which integration kind to connect when the type accepts more than one. Only S3 does: 'aws-s3' (the default) or 's3-compatible' for MinIO, Wasabi, R2, GCS and similar."+ ),+})diff --git a/services/mcp/src/generated/warehouse_sources/api.ts b/services/mcp/src/generated/warehouse_sources/api.tsindex 73a3f0164af5..b0a3fbfdd78e 100644--- a/services/mcp/src/generated/warehouse_sources/api.ts+++ b/services/mcp/src/generated/warehouse_sources/api.ts@@ -3,45 +3,11 @@* MCP service uses these Zod schemas for generated tool handlers.* To regenerate: hogli build:openapi*- * PostHog API - MCP 31 enabled ops+ * PostHog API - MCP 30 enabled ops* OpenAPI spec version: 1.0.0*/import * as zod from 'zod'-/**- * Manage where warehouse sources write their synced rows.- *- * A destination can be attached to several sources, or to a single table on a source.- * Credentials come from an integration, so one connection can be reused across syncs.- */-export const ExternalDataDestinationsListParams = () => 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 ExternalDataDestinationsListQueryParams = () => 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.'),-})--/**- * Manage where warehouse sources write their synced rows.- *- * A destination can be attached to several sources, or to a single table on a source.- * Credentials come from an integration, so one connection can be reused across syncs.- */-export const ExternalDataDestinationsRetrieveParams = () => zod.object({- id: zod.string().describe('A UUID string identifying this external data destination.'),- 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 ExternalDataSchemasListParams = () => zod.object({project_id: zod.string()@@ -2088,6 +2054,29 @@ export const ExternalDataSourcesDestinationsRetrieveParams = () => zod.object({),})+/**+ * Read or replace the destinations every table on this source syncs to.+ *+ * A table with its own override ignores this set until the override is cleared.+ */+export const ExternalDataSourcesDestinationsPartialUpdateParams = () => zod.object({+ id: zod.string().describe('A UUID string identifying this external data source.'),+ 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 ExternalDataSourcesDestinationsPartialUpdateBody = () => zod.object({+ destination_ids: zod+ .array(zod.string())+ .nullish()+ .describe(+ 'Destinations to sync to. On a table, null clears the override so the table follows its source again.'+ ),+})+/*** Fetch current schema/table list from the source and create any new ExternalDataSchema rows (no data sync).*/diff --git a/services/mcp/src/tools/generated/index.ts b/services/mcp/src/tools/generated/index.tsindex 6cfe3a6e7714..f8b56a0a8d7c 100644--- a/services/mcp/src/tools/generated/index.ts+++ b/services/mcp/src/tools/generated/index.ts@@ -64,6 +64,7 @@ import { GENERATED_TOOLS as surveys } from './surveys'import { GENERATED_TOOLS as tasks } from './tasks'import { GENERATED_TOOLS as tracing } from './tracing'import { GENERATED_TOOLS as visual_review } from './visual_review'+import { GENERATED_TOOLS as warehouse_destinations } from './warehouse_destinations'import { GENERATED_TOOLS as warehouse_sources } from './warehouse_sources'import { GENERATED_TOOLS as warehouse_suggestions } from './warehouse_suggestions'import { GENERATED_TOOLS as web_analytics } from './web_analytics'@@ -134,6 +135,7 @@ export const GENERATED_TOOL_MAP: Record<string, () => ToolBase<ZodObjectAny>> =...tasks,...tracing,...visual_review,+ ...warehouse_destinations,...warehouse_sources,...warehouse_suggestions,...web_analytics,diff --git a/services/mcp/src/tools/generated/warehouse_destinations.ts b/services/mcp/src/tools/generated/warehouse_destinations.tsnew file mode 100644index 000000000000..0110514f7906--- /dev/null+++ b/services/mcp/src/tools/generated/warehouse_destinations.ts@@ -0,0 +1,183 @@+// AUTO-GENERATED from products/warehouse_sources/mcp/warehouse_destinations.yaml + OpenAPI — do not edit+import { z } from 'zod'++import type { Schemas } from '@/api/generated'+import * as orvalSchemas from '@/generated/warehouse_destinations/api'+import { withPostHogUrl, type WithPostHogUrl } from '@/tools/tool-utils'+import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'++const ExternalDataDestinationsAddSourcesSchema = () => {+ const ExternalDataDestinationsAddSourcesCreateBody = orvalSchemas.ExternalDataDestinationsAddSourcesCreateBody()+ const ExternalDataDestinationsAddSourcesCreateParams = orvalSchemas.ExternalDataDestinationsAddSourcesCreateParams()+ return ExternalDataDestinationsAddSourcesCreateParams.omit({ project_id: true }).extend(+ ExternalDataDestinationsAddSourcesCreateBody.shape+ )+}++const externalDataDestinationsAddSources = (): ToolBase<+ ReturnType<typeof ExternalDataDestinationsAddSourcesSchema>,+ WithPostHogUrl<Schemas.AddSourcesResponse>+> => ({+ name: 'external-data-destinations-add-sources',+ schema: ExternalDataDestinationsAddSourcesSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof ExternalDataDestinationsAddSourcesSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.source_ids !== undefined) {+ body['source_ids'] = params.source_ids+ }+ if (params.resync !== undefined) {+ body['resync'] = params.resync+ }+ const result = await context.api.request<Schemas.AddSourcesResponse>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/external_data_destinations/${encodeURIComponent(String(params.id))}/add_sources/`,+ body,+ })+ return await withPostHogUrl(context, result, `/data-management/warehouse-destinations?destination=${params.id}`)+ },+})++const ExternalDataDestinationsConnectLinkSchema = () => {+ const ExternalDataDestinationsConnectLinkRetrieveQueryParams =+ orvalSchemas.ExternalDataDestinationsConnectLinkRetrieveQueryParams()+ return ExternalDataDestinationsConnectLinkRetrieveQueryParams+}++const externalDataDestinationsConnectLink = (): ToolBase<+ ReturnType<typeof ExternalDataDestinationsConnectLinkSchema>,+ Schemas.DestinationConnectLink+> => ({+ name: 'external-data-destinations-connect-link',+ schema: ExternalDataDestinationsConnectLinkSchema(),+ handler: async (+ context: Context,+ params: z.infer<ReturnType<typeof ExternalDataDestinationsConnectLinkSchema>>+ ) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.DestinationConnectLink>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/external_data_destinations/connect_link/`,+ query: {+ destination_type: params.destination_type,+ integration_kind: params.integration_kind,+ },+ })+ return result+ },+})++const ExternalDataDestinationsCreateSchema = () => {+ const ExternalDataDestinationsCreateBody = orvalSchemas.ExternalDataDestinationsCreateBody()+ return ExternalDataDestinationsCreateBody+}++const externalDataDestinationsCreate = (): ToolBase<+ ReturnType<typeof ExternalDataDestinationsCreateSchema>,+ WithPostHogUrl<Schemas.ExternalDataDestination>+> => ({+ name: 'external-data-destinations-create',+ schema: ExternalDataDestinationsCreateSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof ExternalDataDestinationsCreateSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.type !== undefined) {+ body['type'] = params.type+ }+ if (params.name !== undefined) {+ body['name'] = params.name+ }+ if (params.config !== undefined) {+ body['config'] = params.config+ }+ if (params.integration !== undefined) {+ body['integration'] = params.integration+ }+ const result = await context.api.request<Schemas.ExternalDataDestination>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/external_data_destinations/`,+ body,+ })+ return await withPostHogUrl(context, result, `/data-management/warehouse-destinations?destination=${result.id}`)+ },+})++const ExternalDataDestinationsListSchema = () => {+ const ExternalDataDestinationsListQueryParams = orvalSchemas.ExternalDataDestinationsListQueryParams()+ return ExternalDataDestinationsListQueryParams+}++const externalDataDestinationsList = (): ToolBase<+ ReturnType<typeof ExternalDataDestinationsListSchema>,+ Schemas.PaginatedExternalDataDestinationList+> => ({+ name: 'external-data-destinations-list',+ schema: ExternalDataDestinationsListSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof ExternalDataDestinationsListSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.PaginatedExternalDataDestinationList>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/external_data_destinations/`,+ query: {+ limit: params.limit,+ offset: params.offset,+ },+ })+ return result+ },+})++const ExternalDataDestinationsRetrieveSchema = () => {+ const ExternalDataDestinationsRetrieveParams = orvalSchemas.ExternalDataDestinationsRetrieveParams()+ return ExternalDataDestinationsRetrieveParams.omit({ project_id: true })+}++const externalDataDestinationsRetrieve = (): ToolBase<+ ReturnType<typeof ExternalDataDestinationsRetrieveSchema>,+ WithPostHogUrl<Schemas.ExternalDataDestination>+> => ({+ name: 'external-data-destinations-retrieve',+ schema: ExternalDataDestinationsRetrieveSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof ExternalDataDestinationsRetrieveSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.ExternalDataDestination>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/external_data_destinations/${encodeURIComponent(String(params.id))}/`,+ })+ return await withPostHogUrl(context, result, `/data-management/warehouse-destinations?destination=${result.id}`)+ },+})++const ExternalDataDestinationsTestConnectionSchema = () => {+ const ExternalDataDestinationsTestConnectionCreateParams =+ orvalSchemas.ExternalDataDestinationsTestConnectionCreateParams()+ return ExternalDataDestinationsTestConnectionCreateParams.omit({ project_id: true })+}++const externalDataDestinationsTestConnection = (): ToolBase<+ ReturnType<typeof ExternalDataDestinationsTestConnectionSchema>,+ Schemas.DestinationConnectionTestResponse+> => ({+ name: 'external-data-destinations-test-connection',+ schema: ExternalDataDestinationsTestConnectionSchema(),+ handler: async (+ context: Context,+ params: z.infer<ReturnType<typeof ExternalDataDestinationsTestConnectionSchema>>+ ) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.DestinationConnectionTestResponse>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/external_data_destinations/${encodeURIComponent(String(params.id))}/test_connection/`,+ })+ return result+ },+})++export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {+ 'external-data-destinations-add-sources': externalDataDestinationsAddSources,+ 'external-data-destinations-connect-link': externalDataDestinationsConnectLink,+ 'external-data-destinations-create': externalDataDestinationsCreate,+ 'external-data-destinations-list': externalDataDestinationsList,+ 'external-data-destinations-retrieve': externalDataDestinationsRetrieve,+ 'external-data-destinations-test-connection': externalDataDestinationsTestConnection,+}diff --git a/services/mcp/src/tools/generated/warehouse_sources.ts b/services/mcp/src/tools/generated/warehouse_sources.tsindex 058c1a0d032d..9ef6d4ea0bc6 100644--- a/services/mcp/src/tools/generated/warehouse_sources.ts+++ b/services/mcp/src/tools/generated/warehouse_sources.ts@@ -96,52 +96,6 @@ const dataWarehouseStoredCredentialsList = (): ToolBase<},})-const ExternalDataDestinationsListSchema = () => {- const ExternalDataDestinationsListQueryParams = orvalSchemas.ExternalDataDestinationsListQueryParams()- return ExternalDataDestinationsListQueryParams-}--const externalDataDestinationsList = (): ToolBase<- ReturnType<typeof ExternalDataDestinationsListSchema>,- Schemas.PaginatedExternalDataDestinationList-> => ({- name: 'external-data-destinations-list',- schema: ExternalDataDestinationsListSchema(),- handler: async (context: Context, params: z.infer<ReturnType<typeof ExternalDataDestinationsListSchema>>) => {- const projectId = await context.stateManager.getProjectId()- const result = await context.api.request<Schemas.PaginatedExternalDataDestinationList>({- method: 'GET',- path: `/api/projects/${encodeURIComponent(String(projectId))}/external_data_destinations/`,- query: {- limit: params.limit,- offset: params.offset,- },- })- return result- },-})--const ExternalDataDestinationsRetrieveSchema = () => {- const ExternalDataDestinationsRetrieveParams = orvalSchemas.ExternalDataDestinationsRetrieveParams()- return ExternalDataDestinationsRetrieveParams.omit({ project_id: true })-}--const externalDataDestinationsRetrieve = (): ToolBase<- ReturnType<typeof ExternalDataDestinationsRetrieveSchema>,- WithPostHogUrl<Schemas.ExternalDataDestination>-> => ({- name: 'external-data-destinations-retrieve',- schema: ExternalDataDestinationsRetrieveSchema(),- handler: async (context: Context, params: z.infer<ReturnType<typeof ExternalDataDestinationsRetrieveSchema>>) => {- const projectId = await context.stateManager.getProjectId()- const result = await context.api.request<Schemas.ExternalDataDestination>({- method: 'GET',- path: `/api/projects/${encodeURIComponent(String(projectId))}/external_data_destinations/${encodeURIComponent(String(params.id))}/`,- })- return await withPostHogUrl(context, result, `/data-management/sources/${result.id}`)- },-})-const ExternalDataSchemasCancelSchema = () => {const ExternalDataSchemasCancelCreateParams = orvalSchemas.ExternalDataSchemasCancelCreateParams()return ExternalDataSchemasCancelCreateParams.omit({ project_id: true })@@ -653,6 +607,44 @@ const externalDataSourcesDestinationsRetrieve = (): ToolBase<},})+const ExternalDataSourcesDestinationsUpdateSchema = () => {+ const ExternalDataSourcesDestinationsPartialUpdateBody =+ orvalSchemas.ExternalDataSourcesDestinationsPartialUpdateBody()+ const ExternalDataSourcesDestinationsPartialUpdateParams =+ orvalSchemas.ExternalDataSourcesDestinationsPartialUpdateParams()+ return ExternalDataSourcesDestinationsPartialUpdateParams.omit({ project_id: true })+ .extend(ExternalDataSourcesDestinationsPartialUpdateBody.shape)+ .extend({+ destination_ids: ExternalDataSourcesDestinationsPartialUpdateBody.shape['destination_ids'].describe(+ 'The full list of destination ids for this source, at least one. A destination left out is detached.'+ ),+ })+}++const externalDataSourcesDestinationsUpdate = (): ToolBase<+ ReturnType<typeof ExternalDataSourcesDestinationsUpdateSchema>,+ Schemas.SourceDestinations+> => ({+ name: 'external-data-sources-destinations-update',+ schema: ExternalDataSourcesDestinationsUpdateSchema(),+ handler: async (+ context: Context,+ params: z.infer<ReturnType<typeof ExternalDataSourcesDestinationsUpdateSchema>>+ ) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.destination_ids !== undefined) {+ body['destination_ids'] = params.destination_ids+ }+ const result = await context.api.request<Schemas.SourceDestinations>({+ method: 'PATCH',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/external_data_sources/${encodeURIComponent(String(params.id))}/destinations/`,+ body,+ })+ return result+ },+})+const ExternalDataSourcesDestroySchema = () => {const ExternalDataSourcesDestroyParams = orvalSchemas.ExternalDataSourcesDestroyParams()return ExternalDataSourcesDestroyParams.omit({ project_id: true })@@ -993,8 +985,6 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'data-warehouse-source-connect-link': dataWarehouseSourceConnectLink,'data-warehouse-source-setup': dataWarehouseSourceSetup,'data-warehouse-stored-credentials-list': dataWarehouseStoredCredentialsList,- 'external-data-destinations-list': externalDataDestinationsList,- 'external-data-destinations-retrieve': externalDataDestinationsRetrieve,'external-data-schemas-cancel': externalDataSchemasCancel,'external-data-schemas-delete-data': externalDataSchemasDeleteData,'external-data-schemas-destinations-retrieve': externalDataSchemasDestinationsRetrieve,@@ -1011,6 +1001,7 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'external-data-sources-create-webhook-create': externalDataSourcesCreateWebhookCreate,'external-data-sources-delete-webhook-create': externalDataSourcesDeleteWebhookCreate,'external-data-sources-destinations-retrieve': externalDataSourcesDestinationsRetrieve,+ 'external-data-sources-destinations-update': externalDataSourcesDestinationsUpdate,'external-data-sources-destroy': externalDataSourcesDestroy,'external-data-sources-list': externalDataSourcesList,'external-data-sources-partial-update': externalDataSourcesPartialUpdate,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-add-sources.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-add-sources.jsonnew file mode 100644index 000000000000..05430f91a3bf--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-add-sources.json@@ -0,0 +1,24 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "description": "A UUID string identifying this external data destination.",+ "type": "string"+ },+ "resync": {+ "default": false,+ "description": "Start a full resync for each enabled table newly attached.",+ "type": "boolean"+ },+ "source_ids": {+ "description": "IDs of up to 50 existing sources to attach to this destination.",+ "items": {+ "type": "string"+ },+ "maxItems": 50,+ "type": "array"+ }+ },+ "required": ["id", "source_ids"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-connect-link.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-connect-link.jsonnew file mode 100644index 000000000000..86934b801241--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-connect-link.json@@ -0,0 +1,17 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "destination_type": {+ "description": "The destination type to connect, e.g. 'Snowflake' or 'S3'.\n\n* `Redshift` - Redshift\n* `Snowflake` - Snowflake\n* `BigQuery` - BigQuery\n* `Postgres` - Postgres\n* `Databricks` - Databricks\n* `AzureBlob` - Azure Blob\n* `S3` - S3",+ "enum": ["Redshift", "Snowflake", "BigQuery", "Postgres", "Databricks", "AzureBlob", "S3"],+ "type": "string"+ },+ "integration_kind": {+ "description": "Which integration kind to connect when the type accepts more than one. Only S3 does: 'aws-s3' (the default) or 's3-compatible' for MinIO, Wasabi, R2, GCS and similar.",+ "minLength": 1,+ "type": "string"+ }+ },+ "required": ["destination_type"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-create.jsonnew file mode 100644index 000000000000..c0cff76eb660--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-create.json@@ -0,0 +1,40 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "config": {+ "description": "Settings for this destination: target database, schema or dataset, bucket and prefix, file format. Credentials are not stored here. They live on the linked integration."+ },+ "integration": {+ "anyOf": [+ {+ "type": "number"+ },+ {+ "type": "null"+ }+ ],+ "description": "Integration holding this destination's credentials. Required for every type except the PostHog warehouse."+ },+ "name": {+ "description": "Human-readable name shown when picking destinations for a source or table.",+ "maxLength": 400,+ "type": "string"+ },+ "type": {+ "description": "Where synced rows are written. The PostHog warehouse is managed for you, so you cannot create one here.\n\n* `PostHogWarehouse` - PostHog warehouse\n* `Redshift` - Redshift\n* `Snowflake` - Snowflake\n* `BigQuery` - BigQuery\n* `Postgres` - Postgres\n* `Databricks` - Databricks\n* `AzureBlob` - Azure Blob\n* `S3` - S3",+ "enum": [+ "PostHogWarehouse",+ "Redshift",+ "Snowflake",+ "BigQuery",+ "Postgres",+ "Databricks",+ "AzureBlob",+ "S3"+ ],+ "type": "string"+ }+ },+ "required": ["type", "name"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-list.jsonnew file mode 100644index 000000000000..8331b796ac73--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-list.json@@ -0,0 +1,14 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "limit": {+ "description": "Number of results to return per page.",+ "type": "number"+ },+ "offset": {+ "description": "The initial index from which to return the results.",+ "type": "number"+ }+ },+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-retrieve.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-retrieve.jsonnew file mode 100644index 000000000000..0b72c279891f--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-retrieve.json@@ -0,0 +1,11 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "description": "A UUID string identifying this external data destination.",+ "type": "string"+ }+ },+ "required": ["id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-test-connection.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-test-connection.jsonnew file mode 100644index 000000000000..0b72c279891f--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-destinations-test-connection.json@@ -0,0 +1,11 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "description": "A UUID string identifying this external data destination.",+ "type": "string"+ }+ },+ "required": ["id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-schemas-destinations-retrieve.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-schemas-destinations-retrieve.jsonnew file mode 100644index 000000000000..567fb6f27984--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-schemas-destinations-retrieve.json@@ -0,0 +1,11 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "description": "A UUID string identifying this external data schema.",+ "type": "string"+ }+ },+ "required": ["id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-destinations-retrieve.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-destinations-retrieve.jsonnew file mode 100644index 000000000000..f4b140f0d7cd--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-destinations-retrieve.json@@ -0,0 +1,11 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "description": "A UUID string identifying this external data source.",+ "type": "string"+ }+ },+ "required": ["id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-destinations-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-destinations-update.jsonnew file mode 100644index 000000000000..9690db978f95--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/external-data-sources-destinations-update.json@@ -0,0 +1,25 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "destination_ids": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "The full list of destination ids for this source, at least one. A destination left out is detached."+ },+ "id": {+ "description": "A UUID string identifying this external data source.",+ "type": "string"+ }+ },+ "required": ["id"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/tool-schema-snapshots.test.ts b/services/mcp/tests/unit/tool-schema-snapshots.test.tsindex e320bd38f4da..95dcfc3e4f90 100644--- a/services/mcp/tests/unit/tool-schema-snapshots.test.ts+++ b/services/mcp/tests/unit/tool-schema-snapshots.test.ts@@ -113,6 +113,7 @@ async function loadSnapshotTools(): Promise<Tool<ZodObjectAny>[]> {'activity-summary': true,'aeo-citation-tracking': true,'anomalies-search': true,+ 'warehouse-multi-destination': true,'feature-flag-rules-v2-mcp': true,}return [...(await getToolsFromContext(createMockContext(), { featureFlags }))].sort((a, b) =>