: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
# 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 batch_exports
# Add one: pnpm --filter=@posthog/mcp run scaffold-yaml -- --add <operationId> --product batch_exports
# To keep an operation off on purpose, set enabled: false and give a disabled_reason.
category: Data pipelines
feature: batch_exports
url_prefix: /data-management/destinations
ui_apps: {}
tools:
batch-export-create:
operation: batch_exports_create
enabled: true
scopes:
- batch_export:write
annotations:
readOnly: false
destructive: false
idempotent: false
title: Create batch export
description: >
Create a new batch export. This tool supports typed destination configs for Databricks, AzureBlob, BigQuery,
Postgres, AwsS3, S3Compatible, Snowflake, and Redshift. All require a team-scoped integration for
credentials. Use integrations-list to find one and pass its ID as destination.integration_id. Always specify
the model field (events, persons, sessions, or hogql). Omitting it defaults to events. For the hogql model,
provide hogql_query. Optionally provide hogql_modifiers, which override the project HogQL modifiers with the
same names for this export only. Timestamps are exported in UTC unless the export or the project sets
convertToProjectTimezone, for example {"convertToProjectTimezone": true} to export them in the project
timezone. incremental_mode accepts APPEND (the default) or MERGE for any model. For hogql, MERGE requires a
primary_key. Use nonempty lists of query output column names or aliases for primary_key and the optional
version_key. These keys are only configurable for the hogql model.
exclude_params:
- id
- team_id
- created_at
- last_updated_at
- last_paused_at
- latest_runs
- filters
- start_at
- end_at
- integration
batch-export-delete:
operation: batch_exports_destroy
enabled: true
scopes:
- batch_export:write
annotations:
readOnly: false
destructive: true
idempotent: true
title: Delete batch export
description: >
Soft-delete a batch export. Stops all future scheduled runs and hides the export from list and get
operations. Historic run records remain attached to the deleted export in the database.
batch-export-get:
operation: batch_exports_retrieve
enabled: true
scopes:
- batch_export:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: Get batch export
description: >
Get a batch export by ID. Returns full non-sensitive configuration including destination type and config,
linked integration ID when present, schedule, model, incremental_mode, and the 10 most recent runs.
batch-export-update:
operation: batch_exports_partial_update
enabled: true
scopes:
- batch_export:write
annotations:
readOnly: false
destructive: false
idempotent: true
title: Update batch export
description: >
Partially update a batch export. Top-level fields (name, paused, interval, timezone, offset_day,
offset_hour, incremental_mode) work for any destination type. incremental_mode accepts APPEND or MERGE; omit
it to preserve the saved mode. For the hogql model, hogql_query, hogql_modifiers, primary_key, and
version_key can also change. Keys use query output column names or aliases, and MERGE requires a
primary_key. hogql_modifiers replaces the stored object rather than merging into it, so read the current
value with batch-export-get and send every modifier to keep, or send null to remove them all. Timestamps are
exported in UTC unless the export or the project sets convertToProjectTimezone to true. Typed destination
config updates are available for Databricks, AzureBlob, BigQuery, Postgres, AwsS3, S3Compatible, Snowflake,
and Redshift. The destination type cannot be changed. Do not change the model field on an existing batch
export.
exclude_params:
- id
- team_id
- created_at
- last_updated_at
- last_paused_at
- latest_runs
- filters
- integration
batch-exports-list:
operation: batch_exports_list
enabled: true
scopes:
- batch_export:read
annotations:
readOnly: true
destructive: false
idempotent: true
list: true
title: List batch exports
description: >
List batch exports in the project. Batch exports send event, person, session data, or HogQL query results to
destinations like S3, Snowflake, BigQuery, Databricks, Azure Blob, Postgres, Redshift, or HTTP. Returns
destination type, incremental_mode, interval, paused state, and non-sensitive config; credentials are never
exposed. Use batch-export-get with the ID for full details including latest runs, query, and filters.
response:
include:
- id
- name
- model
- incremental_mode
- destination
- interval
- paused
- created_at
- last_updated_at
- start_at
- end_at
file-download-batch-exports-cancel-create:
operation: file_download_batch_exports_cancel_create
enabled: true
scopes:
- batch_export:write
annotations:
readOnly: false
destructive: false
idempotent: false
title: Cancel a running file download export
description: >
Cancel a running or starting on-demand file download export. When the status is not Starting or Running
calling this will fail. Returns the status of the export after cancelling, which is always Cancelled.
file-download-batch-exports-count-rows-create:
operation: file_download_batch_exports_count_rows_create
enabled: true
scopes:
- batch_export:write
annotations:
readOnly: true
destructive: false
idempotent: true
title: Count rows a HogQL file download export would produce
description: >
Count the rows a HogQL file download export would produce if started now, without starting an export. Only
the hogql model is supported; it is in closed beta and enabled per team, and this returns a permission error
naming HogQL batch exports when the team does not have it enabled, in which case tell the user they can
contact PostHog support to request access. Counting runs the full query on ClickHouse, so it can take a
while and can fail with a timeout for heavy unbounded queries. If the user wishes to estimate the size of an
export, use it before file-download-batch-exports-create to check a hogql_query returns the amount of data
the user expects, and tighten its WHERE clause when the count is much larger than expected. Pass the same
hogql_modifiers as the export, so that the count resolves the query the same way. Running count queries is
potentially as expensive as running the actual export query, so consider whether this is worth it.
file-download-batch-exports-create:
operation: file_download_batch_exports_create
enabled: true
scopes:
- batch_export:write
annotations:
readOnly: false
destructive: false
idempotent: false
title: Start file download export
description: >
Start an on-demand batch export that prepares downloadable files for events, persons, sessions, or the
results of a HogQL query. For events, persons and sessions, provide data_interval_start and
data_interval_end as ISO 8601 datetimes; the interval must be at most one week, and for events, include and
exclude filter event names. The hogql model is in closed beta and is enabled per team: it takes a
hogql_query, which can reference the {data_interval_start} and {data_interval_end} placeholders filled from
data_interval_start and data_interval_end, and optional hogql_modifiers, which override the project HogQL
modifiers with the same names. Timestamps are exported in UTC unless the export or the project sets
convertToProjectTimezone, for example {"convertToProjectTimezone": true} to export them in the project
timezone. It returns a permission error naming HogQL batch exports when the team does not have it enabled,
in which case tell the user they can contact PostHog support to request access. Limit hogql_query with a
WHERE clause to export only the data the user asked for, because user queries run under stricter resource
limits than the other models. The export splits into files of about 1024 MiB by default, and a file can go a
little over; set file.max_size_mb to change that size, or to null to write a single file of any size. Use
file-download-batch-exports-retrieve with the returned id to poll until status is Completed, then follow the
downloading-batch-export-files skill to download the files through the existing REST download endpoint.
file-download-batch-exports-retrieve:
operation: file_download_batch_exports_retrieve
enabled: true
scopes:
- batch_export:read
annotations:
readOnly: true
destructive: false
idempotent: true
title: Get file download export status
description: >
Get the status of an on-demand file download export. Returns Starting or Running while the export is in
progress, Completed with file IDs when files are ready, or a failed status with an error message. A
Completed response also reports records_completed, the number of rows the run exported; report that count to
the user. When status is Completed, use the downloading-batch-export-files skill to download each file
through the existing REST download endpoint; the generated MCP download operation is intentionally not
enabled because it is a redirect to the file body.