: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(signals): add MCP report feedback control (#117932)
Dylan Martinaa97bd089009
diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yamlindex b7257cdb3e66..369bc05007d0 100644--- a/products/signals/mcp/tools.yaml+++ b/products/signals/mcp/tools.yaml@@ -219,6 +219,35 @@ tools:id:aliases:- report_id+ inbox-reports-feedback-create:+ operation: signals_reports_feedback_create+ enabled: true+ scopes:+ - task:read+ - signal_scout:write+ - llm_skill:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: false+ enrich_url: '{params.id}'+ title: Rate a signal report+ description: >+ Record a person's thumbs up or thumbs down on a signal report, with their context for why: `positive` means+ thumbs up and `negative` means thumbs down. Pass the person's verdict, never your own interpretation of the+ report. The note is forwarded to the scout that authored or edited the report as steering context for its+ next run; the response says whether it was forwarded. This does not dismiss, resolve, or otherwise change+ the report's state. Each successful call can create a new steering note, so do not retry after a confirmed+ success.+ param_overrides:+ id:+ aliases:+ - report_id+ sentiment:+ input_schema: SignalReportFeedbackSentimentSchema+ note:+ description: The person's context for why the report was or was not useful, up to 4000 characters.+ input_schema: SignalReportFeedbackNoteSchemainbox-reports-leave-reviewers:operation: signals_reports_reviewers_me_destroyenabled: truediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex bf2a7a9d8285..c035e0b12a9c 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -7119,6 +7119,20 @@"readOnlyHint": false}},+ "inbox-reports-feedback-create": {+ "description": "Record a person's thumbs up or thumbs down on a signal report, with their context for why: `positive` means thumbs up and `negative` means thumbs down. Pass the person's verdict, never your own interpretation of the report. The note is forwarded to the scout that authored or edited the report as steering context for its next run; the response says whether it was forwarded. This does not dismiss, resolve, or otherwise change the report's state. Each successful call can create a new steering note, so do not retry after a confirmed success.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Rate a signal report",+ "title": "Rate a signal report",+ "required_scopes": ["task:read", "signal_scout:write", "llm_skill:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ }+ },"inbox-reports-leave-reviewers": {"description": "Take the authenticated user off this report's suggested reviewers, leaving the other reviewers in place. Use it when a report was routed to them by mistake, so it stops reaching them without closing it for anyone else. The report's own state does not change: it stays open for whoever is left, and for the project. Succeeds whether or not the user was on the list, so a repeat call is safe. To change who else reviews a report, edit its `suggested_reviewers` artefact instead.","category": "Signals",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 56232f4db53a..ced086a2b5f8 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -7316,6 +7316,20 @@"readOnlyHint": false}},+ "inbox-reports-feedback-create": {+ "description": "Record a person's thumbs up or thumbs down on a signal report, with their context for why: `positive` means thumbs up and `negative` means thumbs down. Pass the person's verdict, never your own interpretation of the report. The note is forwarded to the scout that authored or edited the report as steering context for its next run; the response says whether it was forwarded. This does not dismiss, resolve, or otherwise change the report's state. Each successful call can create a new steering note, so do not retry after a confirmed success.",+ "category": "Signals",+ "feature": "signals",+ "summary": "Rate a signal report",+ "title": "Rate a signal report",+ "required_scopes": ["task:read", "signal_scout:write", "llm_skill:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ }+ },"inbox-reports-leave-reviewers": {"description": "Take the authenticated user off this report's suggested reviewers, leaving the other reviewers in place. Use it when a report was routed to them by mistake, so it stops reaching them without closing it for anyone else. The report's own state does not change: it stays open for whoever is left, and for the project. Succeeds whether or not the user was on the list, so a repeat call is safe. To change who else reviews a report, edit its `suggested_reviewers` artefact instead.","category": "Signals",diff --git a/services/mcp/schema/tool-inputs.json b/services/mcp/schema/tool-inputs.jsonindex 03995ca82604..5f2c16599e47 100644--- a/services/mcp/schema/tool-inputs.json+++ b/services/mcp/schema/tool-inputs.json@@ -1694,6 +1694,17 @@],"description": "Immutable scorer configuration. Pick the shape matching the scorer kind: categorical (options + selection_mode + optional passing_rule.categories), numeric (min/max/step + optional passing_rule), or boolean (true_label/false_label + optional true_is_failure). The server validates the shape against the kind on the parent scorer and returns 400 on a mismatch."},+ "SignalReportFeedbackNoteSchema": {+ "type": "string",+ "minLength": 1,+ "maxLength": 4000,+ "description": "The person's context for why the report was or was not useful, up to 4000 characters."+ },+ "SignalReportFeedbackSentimentSchema": {+ "type": "string",+ "enum": ["positive", "negative"],+ "description": "The report rating: 'positive' (thumbs up) or 'negative' (thumbs down)."+ },"TaskAgentCreateSchema": {"type": "object","properties": {diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex a02cb7c9daea..ab852d297c8a 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -3,7 +3,7 @@* MCP service uses these Zod schemas for generated tool handlers.* To regenerate: hogli build:openapi*- * PostHog API - MCP 65 enabled ops+ * PostHog API - MCP 66 enabled ops* OpenAPI spec version: 1.0.0*/import * as zod from 'zod'@@ -383,6 +383,40 @@ export const SignalsReportsClaimBody = () => zod.object({.describe('Release ownership while preserving any attached pull request.'),})+/**+ * Record the thumbs rating at the end of a report, with an optional note. For browser-session requests the rating is persisted as a per-person report action, which counts as consumption evidence for the scout that authored the report (scouts whose output nobody consumes are eventually paused); requests authenticated any other way record no action. When a note is present and the report was authored by a scout, the note is also forwarded to that scout as a steering note it reads on its next run; for any other report there is nothing to steer. The report's state is never changed.+ * @summary Leave feedback on a report+ */+export const SignalsReportsFeedbackCreateParams = () => zod.object({+ id: zod.string().describe('A UUID string identifying this signal report.'),+ 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 signalsReportsFeedbackCreateBodyNoteDefault = ``+export const signalsReportsFeedbackCreateBodyNoteMax = 4000++export const SignalsReportsFeedbackCreateBody = () => zod.object({+ sentiment: zod+ .union([+ zod.enum(['positive', 'negative']).describe('\* `positive` - positive\n\* `negative` - negative'),+ zod.null(),+ ])+ .describe(+ "The report rating: 'positive' (thumbs up), 'negative' (thumbs down), or null to clear it.\n\n\* `positive` - positive\n\* `negative` - negative"+ ),+ note: zod+ .string()+ .max(signalsReportsFeedbackCreateBodyNoteMax)+ .default(signalsReportsFeedbackCreateBodyNoteDefault)+ .describe(+ 'Free-form note explaining the rating. Capped at 4000 characters. Optional — a bare thumb carries none. When present and the report was authored by a scout, the note is forwarded to that scout as a steering note.'+ ),+})+/*** Fold one or more duplicate reports into this report, which survives. The sources' signals, work-log artefacts, pull requests, task runs and checks move onto the survivor, the survivor's signal counters take on theirs, and each source is archived with a 'duplicate of' link back to the survivor. A source's open pull request stays open, because the survivor holds it after the move. Pick the survivor deliberately: prefer the older report, and prefer the one with an open implementation PR or an active claim. Any active claim on a source is released, so re-claim the survivor if you were working on one. Titles and summaries are not combined, so edit it afterwards if it needs a rewrite. A merged report keeps its URL but cannot be restored, because its signals now belong to the survivor.* @summary Merge duplicate reports into this onediff --git a/services/mcp/src/schema/tool-inputs.ts b/services/mcp/src/schema/tool-inputs.tsindex 0b0a115f21e4..e5a28e025b86 100644--- a/services/mcp/src/schema/tool-inputs.ts+++ b/services/mcp/src/schema/tool-inputs.ts@@ -13,6 +13,15 @@ import { castStringToInt, normalizeParamAliases } from '../tools/cast-helpers'export const CanvasStateReadLimitSchema = z.number().int().min(1).max(100).default(20)export const CanvasStateKeysOnlySchema = z.boolean().default(true)export const WikiPageReadLimitSchema = z.number().int().min(1).max(12000).default(12000)+export const SignalReportFeedbackSentimentSchema = z+ .enum(['positive', 'negative'])+ .describe("The report rating: 'positive' (thumbs up) or 'negative' (thumbs down).")+export const SignalReportFeedbackNoteSchema = z+ .string()+ .trim()+ .min(1)+ .max(4000)+ .describe("The person's context for why the report was or was not useful, up to 4000 characters.")// Mirrors the Django serializer's `validate` rule so a continuation without the revision// fails here instead of at the API with a 400.diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex 0604568bae5f..861473aec07e 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -3,6 +3,7 @@ import { z } from 'zod'import type { Schemas } from '@/api/generated'import * as orvalSchemas from '@/generated/signals/api'+import { SignalReportFeedbackNoteSchema, SignalReportFeedbackSentimentSchema } from '@/schema/tool-inputs'import { normalizeParamAliases } from '@/tools/cast-helpers'import {withPostHogUrl,@@ -365,6 +366,41 @@ const inboxReportsClaim = (): ToolBase<},})+const InboxReportsFeedbackCreateSchema = () => {+ const SignalsReportsFeedbackCreateBody = orvalSchemas.SignalsReportsFeedbackCreateBody()+ const SignalsReportsFeedbackCreateParams = orvalSchemas.SignalsReportsFeedbackCreateParams()+ return z.preprocess(+ normalizeParamAliases({ id: ['report_id'] }),+ SignalsReportsFeedbackCreateParams.omit({ project_id: true })+ .extend(SignalsReportsFeedbackCreateBody.shape)+ .extend({ sentiment: SignalReportFeedbackSentimentSchema, note: SignalReportFeedbackNoteSchema })+ )+}++const inboxReportsFeedbackCreate = (): ToolBase<+ ReturnType<typeof InboxReportsFeedbackCreateSchema>,+ WithPostHogUrl<Schemas.SignalReportFeedbackResponse>+> => ({+ name: 'inbox-reports-feedback-create',+ schema: InboxReportsFeedbackCreateSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof InboxReportsFeedbackCreateSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.sentiment !== undefined) {+ body['sentiment'] = params.sentiment+ }+ if (params.note !== undefined) {+ body['note'] = params.note+ }+ const result = await context.api.request<Schemas.SignalReportFeedbackResponse>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/reports/${encodeURIComponent(String(params.id))}/feedback/`,+ body,+ })+ return await withPostHogUrl(context, result, `/inbox/${params.id}`)+ },+})+const InboxReportsLeaveReviewersSchema = () => {const SignalsReportsReviewersMeDestroyParams = orvalSchemas.SignalsReportsReviewersMeDestroyParams()return z.preprocess(@@ -3113,6 +3149,7 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'inbox-report-checks-retrieve': inboxReportChecksRetrieve,'inbox-reports-bulk-set-state': inboxReportsBulkSetState,'inbox-reports-claim': inboxReportsClaim,+ 'inbox-reports-feedback-create': inboxReportsFeedbackCreate,'inbox-reports-leave-reviewers': inboxReportsLeaveReviewers,'inbox-reports-list': inboxReportsList,'inbox-reports-merge': inboxReportsMerge,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-feedback-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-feedback-create.jsonnew file mode 100644index 000000000000..9bb68701eb73--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-feedback-create.json@@ -0,0 +1,22 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "description": "A UUID string identifying this signal report.",+ "type": "string"+ },+ "note": {+ "description": "The person's context for why the report was or was not useful, up to 4000 characters.",+ "maxLength": 4000,+ "minLength": 1,+ "type": "string"+ },+ "sentiment": {+ "description": "The report rating: 'positive' (thumbs up) or 'negative' (thumbs down).",+ "enum": ["positive", "negative"],+ "type": "string"+ }+ },+ "required": ["id", "sentiment", "note"],+ "type": "object"+}