: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(signals): accept report_id alias on inbox-reports-retrieve (#91264)
posthog[bot]45dd64998d1f
diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yamlindex fcfa93840fee..f271faeeea2a 100644--- a/products/signals/mcp/tools.yaml+++ b/products/signals/mcp/tools.yaml@@ -215,6 +215,10 @@ tools:remote branch). Status artefacts (priority, actionability, reviewers) are latest-wins — append a new versionto re-assess. Without the write tools, work as instructed by your task — artefact persistence is handled foryou."+ param_overrides:+ id:+ aliases:+ - report_idinbox-reports-set-state:operation: signals_reports_state_createenabled: truediff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex bcb4091923b3..8f6ee5766fe7 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -54,6 +54,7 @@ import {SignalsSourceConfigsUpdateBody,SignalsSourceConfigsUpdateParams,} from '@/generated/signals/api'+import { normalizeParamAliases } from '@/tools/cast-helpers'import { getConfirmedActionRuntime } from '@/tools/confirmed-action-registry'import {executeConfirmedAction,@@ -286,7 +287,10 @@ const inboxReportsList = (): ToolBase<},})-const InboxReportsRetrieveSchema = SignalsReportsRetrieveParams.omit({ project_id: true })+const InboxReportsRetrieveSchema = z.preprocess(+ normalizeParamAliases({ id: ['report_id'] }),+ SignalsReportsRetrieveParams.omit({ project_id: true })+)const inboxReportsRetrieve = (): ToolBase<typeof InboxReportsRetrieveSchema,diff --git a/services/mcp/tests/unit/inbox-reports-retrieve-aliases.test.ts b/services/mcp/tests/unit/inbox-reports-retrieve-aliases.test.tsnew file mode 100644index 000000000000..8a866c5ec523--- /dev/null+++ b/services/mcp/tests/unit/inbox-reports-retrieve-aliases.test.ts@@ -0,0 +1,29 @@+import { describe, expect, it } from 'vitest'++import { GENERATED_TOOLS } from '@/tools/generated/signals'++// The report family splits on the identifier key: `inbox-reports-retrieve` takes+// `id`, but the sibling `inbox-report-artefacts-*` tools take `report_id`, and+// the scout prose calls a report's id `report_id` throughout. Agents carry that+// key over and call retrieve with `report_id`, which used to fail validation. The+// alias normalizes `report_id` to `id` so the documented call works either way.+describe('inbox-reports-retrieve report_id alias', () => {+ const schema = GENERATED_TOOLS['inbox-reports-retrieve']!().schema+ const REPORT_UUID = '01a04d4c-9994-716b-8038-10627229a016'++ it.each([+ ['id (the documented example)', { id: REPORT_UUID }, REPORT_UUID],+ ['report_id', { report_id: REPORT_UUID }, REPORT_UUID],+ ['id over report_id on conflict', { id: REPORT_UUID, report_id: 'other' }, REPORT_UUID],+ ])('accepts %s and normalizes to `id`', (_label, input, expected) => {+ const result = schema.safeParse(input)+ expect(result.success).toBe(true)+ const data = result.data as Record<string, unknown>+ expect(data.id).toEqual(expected)+ expect(data).not.toHaveProperty('report_id')+ })++ it('still rejects a call with no identifier', () => {+ expect(schema.safeParse({}).success).toBe(false)+ })+})