: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
fix(mcp): cap annotations-list default page at 100 and trim created_by echo (#68389)
posthog[bot]9e34e95d72cd
diff --git a/products/annotations/mcp/tools.yaml b/products/annotations/mcp/tools.yamlindex f55018a39c4b..808caf856f80 100644--- a/products/annotations/mcp/tools.yaml+++ b/products/annotations/mcp/tools.yaml@@ -73,7 +73,22 @@ tools:title: List annotationsdescription: >List annotations in the current project, newest first. Use this to review existing deployment markers and- analysis notes before adding new annotations.+ analysis notes before adding new annotations. Results are paginated (default 100 per page) — use `limit` and+ `offset` to page through, and `search` to filter by annotation content. Each row's `created_by` is trimmed+ to `{id, email}`.+ param_overrides:+ limit:+ description: Number of annotations to return per page (default 100).+ default: 100+ response:+ exclude:+ - created_by.uuid+ - created_by.distinct_id+ - created_by.first_name+ - created_by.last_name+ - created_by.is_email_verified+ - created_by.hedgehog_config+ - created_by.role_at_organizationannotations-partial-update:operation: annotations_partial_updateenabled: truediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex ec80565706e3..da96e2549ea2 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -943,7 +943,7 @@}},"annotations-list": {- "description": "List annotations in the current project, newest first. Use this to review existing deployment markers and analysis notes before adding new annotations.",+ "description": "List annotations in the current project, newest first. Use this to review existing deployment markers and analysis notes before adding new annotations. Results are paginated (default 100 per page) — use `limit` and `offset` to page through, and `search` to filter by annotation content. Each row's `created_by` is trimmed to `{id, email}`.","category": "Annotations","feature": "annotations","summary": "List annotations",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 232feed2a6c2..51e2d879d782 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -973,7 +973,7 @@}},"annotations-list": {- "description": "List annotations in the current project, newest first. Use this to review existing deployment markers and analysis notes before adding new annotations.",+ "description": "List annotations in the current project, newest first. Use this to review existing deployment markers and analysis notes before adding new annotations. Results are paginated (default 100 per page) — use `limit` and `offset` to page through, and `search` to filter by annotation content. Each row's `created_by` is trimmed to `{id, email}`.","category": "Annotations","feature": "annotations","summary": "List annotations",diff --git a/services/mcp/src/tools/generated/annotations.ts b/services/mcp/src/tools/generated/annotations.tsindex 24936a918b1c..ce51fff73175 100644--- a/services/mcp/src/tools/generated/annotations.ts+++ b/services/mcp/src/tools/generated/annotations.ts@@ -11,7 +11,7 @@ import {AnnotationsRetrieveParams,} from '@/generated/annotations/api'import { castStringToInt } from '@/tools/cast-helpers'-import { withPostHogUrl, type WithPostHogUrl } from '@/tools/tool-utils'+import { withPostHogUrl, omitResponseFields, type WithPostHogUrl } from '@/tools/tool-utils'import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'const AnnotationCreateSchema = AnnotationsCreateBody.omit({@@ -84,7 +84,12 @@ const annotationRetrieve = (): ToolBase<typeof AnnotationRetrieveSchema, Schemas},})-const AnnotationsListSchema = AnnotationsListQueryParams+const AnnotationsListSchema = AnnotationsListQueryParams.extend({+ limit: AnnotationsListQueryParams.shape['limit']+ .default(100)+ .optional()+ .describe('Number of annotations to return per page (default 100).'),+})const annotationsList = (): ToolBase<typeof AnnotationsListSchema,@@ -103,7 +108,21 @@ const annotationsList = (): ToolBase<search: params.search,},})- return await withPostHogUrl(context, result, '/data-management/annotations')+ const filtered = {+ ...result,+ results: (result.results ?? []).map((item: any) =>+ omitResponseFields(item, [+ 'created_by.uuid',+ 'created_by.distinct_id',+ 'created_by.first_name',+ 'created_by.last_name',+ 'created_by.is_email_verified',+ 'created_by.hedgehog_config',+ 'created_by.role_at_organization',+ ])+ ),+ } as typeof result+ return await withPostHogUrl(context, filtered, '/data-management/annotations')},})diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/annotations-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/annotations-list.jsonindex bc560e594d69..7a4d659dc9be 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/annotations-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/annotations-list.json@@ -2,7 +2,8 @@"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {"limit": {- "description": "Number of results to return per page.",+ "default": 100,+ "description": "Number of annotations to return per page (default 100).","type": "number"},"offset": {