: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(mcp): generalize agent-feedback tool for any posthog feedback (#65342)
Andrew Maguireb5c8629b638d
diff --git a/frontend/src/taxonomy/core-filter-definitions-by-group.json b/frontend/src/taxonomy/core-filter-definitions-by-group.jsonindex f378b4bfbc9e..eef7de5d2cbb 100644--- a/frontend/src/taxonomy/core-filter-definitions-by-group.json+++ b/frontend/src/taxonomy/core-filter-definitions-by-group.json@@ -3952,7 +3952,7 @@"label": "Deep link opened"},"mcp feedback submitted": {- "description": "Fires when a user submits feedback through the MCP server's feedback tool.",+ "description": "Fires when feedback is submitted through the MCP server's feedback tool — about any PostHog product, the MCP server itself, or the docs.","label": "MCP feedback submitted"},"mcp init": {diff --git a/posthog/taxonomy/taxonomy.py b/posthog/taxonomy/taxonomy.pyindex 39f991e6e384..8b49d6260608 100644--- a/posthog/taxonomy/taxonomy.py+++ b/posthog/taxonomy/taxonomy.py@@ -412,7 +412,7 @@ CORE_FILTER_DEFINITIONS_BY_GROUP: dict[str, dict[str, CoreFilterDefinition]] = {},"mcp feedback submitted": {"label": "MCP feedback submitted",- "description": "Fires when a user submits feedback through the MCP server's feedback tool.",+ "description": "Fires when feedback is submitted through the MCP server's feedback tool — about any PostHog product, the MCP server itself, or the docs.",},"$snapshot": {"label": "Session recording snapshot",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 012bd3e9a5d3..12f0f97a063e 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -742,11 +742,11 @@"feature_flag": "agent-platform"},"agent-feedback": {- "description": "Optional: report a concrete problem with this PostHog MCP server itself — a tool, input schema, response format, error, or these instructions. Keep feedback about the MCP, not the user's task, their data, or your findings. ONLY use this when something went wrong or was missing: friction that slowed you down, a surprise, a missing capability, an unhelpful error, wrong results, or unclear docs. Feedback must be constructive and actionable — point at a specific defect the PostHog team can fix and name the change in `suggested_improvement`. Do NOT submit positive or 'everything worked' reports — they are noise we cannot act on. Skip it entirely for routine tasks where nothing went wrong. Keep `summary` to one sentence and write the free-text fields as clear, concise bullet points, quoting tool names, parameters, and error messages where possible. Do not include user PII or sensitive query content. IMPORTANT: submitting feedback does NOT mean your work is done — keep going and finish the user's task using the other available tools. This tool is for reporting problems to the PostHog team, not for ending the conversation.",+ "description": "Send feedback about anything PostHog to the PostHog team. Set `feedback_type` to route it: `product` (any PostHog product or feature — insights, session replay, feature flags, the data warehouse, web analytics, error tracking, etc.; put the area in `product_area`), `mcp` (this MCP server itself — a tool, input schema, response format, error, or these instructions; set `category`), `docs`, or `other`. ALL sentiments are welcome via `sentiment` (`positive`/`neutral`/`negative`/`mixed`) — praise and feature requests are useful signal, not just problems. Good triggers: a confusing or broken product experience, a papercut that slowed the task down, a missing capability you worked around, a feature request, an unhelpful error, or something that worked really well. Keep `summary` to one sentence and write the free-text fields as clear, concise bullet points, quoting the product surface, tool name, parameter, or error text where possible. Include a concrete `suggested_improvement` whenever you can name one. Do not include user PII or sensitive query content. The user can also ask you to send feedback directly (e.g. 'make a PostHog feedback for this'). IMPORTANT: submitting feedback does NOT mean your work is done — keep going and finish the user's task using the other available tools. This tool is a side channel to the PostHog team, not a way to end the conversation.","category": "Feedback","feature": "feedback",- "summary": "Optional: report a problem with the PostHog MCP server.",- "title": "Submit agent feedback",+ "summary": "Send feedback about any PostHog product, this MCP, or the docs.",+ "title": "Submit PostHog feedback","required_scopes": [],"always_available": true,"feature_flag": "mcp-feedback-tool",diff --git a/services/mcp/schema/tool-definitions.json b/services/mcp/schema/tool-definitions.jsonindex 761c4f7821c5..42680d7204cf 100644--- a/services/mcp/schema/tool-definitions.json+++ b/services/mcp/schema/tool-definitions.json@@ -14,11 +14,11 @@}},"agent-feedback": {- "description": "Optional: report a concrete problem with this PostHog MCP server itself — a tool, input schema, response format, error, or these instructions. Keep feedback about the MCP, not the user's task, their data, or your findings. ONLY use this when something went wrong or was missing: friction that slowed you down, a surprise, a missing capability, an unhelpful error, wrong results, or unclear docs. Feedback must be constructive and actionable — point at a specific defect the PostHog team can fix and name the change in `suggested_improvement`. Do NOT submit positive or 'everything worked' reports — they are noise we cannot act on. Skip it entirely for routine tasks where nothing went wrong. Keep `summary` to one sentence and write the free-text fields as clear, concise bullet points, quoting tool names, parameters, and error messages where possible. Do not include user PII or sensitive query content. IMPORTANT: submitting feedback does NOT mean your work is done — keep going and finish the user's task using the other available tools. This tool is for reporting problems to the PostHog team, not for ending the conversation.",+ "description": "Send feedback about anything PostHog to the PostHog team. Set `feedback_type` to route it: `product` (any PostHog product or feature — insights, session replay, feature flags, the data warehouse, web analytics, error tracking, etc.; put the area in `product_area`), `mcp` (this MCP server itself — a tool, input schema, response format, error, or these instructions; set `category`), `docs`, or `other`. ALL sentiments are welcome via `sentiment` (`positive`/`neutral`/`negative`/`mixed`) — praise and feature requests are useful signal, not just problems. Good triggers: a confusing or broken product experience, a papercut that slowed the task down, a missing capability you worked around, a feature request, an unhelpful error, or something that worked really well. Keep `summary` to one sentence and write the free-text fields as clear, concise bullet points, quoting the product surface, tool name, parameter, or error text where possible. Include a concrete `suggested_improvement` whenever you can name one. Do not include user PII or sensitive query content. The user can also ask you to send feedback directly (e.g. 'make a PostHog feedback for this'). IMPORTANT: submitting feedback does NOT mean your work is done — keep going and finish the user's task using the other available tools. This tool is a side channel to the PostHog team, not a way to end the conversation.","category": "Feedback","feature": "feedback",- "summary": "Optional: report a problem with the PostHog MCP server.",- "title": "Submit agent feedback",+ "summary": "Send feedback about any PostHog product, this MCP, or the docs.",+ "title": "Submit PostHog feedback","required_scopes": [],"always_available": true,"feature_flag": "mcp-feedback-tool",diff --git a/services/mcp/schema/tool-inputs.json b/services/mcp/schema/tool-inputs.jsonindex a9ec196ae4b5..02ecf8c4dcd2 100644--- a/services/mcp/schema/tool-inputs.json+++ b/services/mcp/schema/tool-inputs.json@@ -397,14 +397,24 @@"summary": {"type": "string","minLength": 1,- "description": "A one-sentence headline naming the problem (e.g. \"query-trends descriptions made it hard to choose between trends and funnels\"). Only submit when something went wrong or was missing — never for positive or \"everything worked\" feedback."+ "description": "A one-sentence headline capturing the feedback (e.g. \"session replay scrubber jumps backwards when you click the timeline\", \"query-trends descriptions made it hard to choose between trends and funnels\", or \"the new SQL editor autocomplete is excellent\")."+ },+ "feedback_type": {+ "type": "string",+ "enum": ["product", "mcp", "docs", "other"],+ "description": "What this feedback is about. \"product\" = any PostHog product or feature (insights, session replay, feature flags, the data warehouse, web analytics, error tracking, etc.). \"mcp\" = this MCP server itself — a tool, its input schema, response format, an error, or these instructions. \"docs\" = PostHog documentation. \"other\" = anything that doesn't fit the above."},"sentiment": {"type": "string",- "enum": ["negative", "mixed"],- "description": "How much the MCP server got in your way for this task. Use \"negative\" if it blocked you, \"mixed\" if it mostly worked but had a concrete problem worth fixing. Do not submit purely positive feedback — only report problems."+ "enum": ["positive", "neutral", "negative", "mixed"],+ "description": "The overall tone. Use \"negative\" for something broken or blocking, \"mixed\" for mostly-fine-but-with-a-concrete-problem, \"neutral\" for a suggestion or feature request with no strong sentiment, and \"positive\" for praise or something that worked well. All sentiments are welcome — positive feedback is encouraged, not just problems."+ },+ "product_area": {+ "description": "The PostHog product or area this is about, in free text (e.g. \"session replay\", \"insights\", \"data warehouse\", \"feature flags\", \"docs\"). Most useful for product feedback; for MCP feedback the tool name belongs in `details`/`friction_points` instead.",+ "type": "string"},"category": {+ "description": "For MCP feedback (`feedback_type: \"mcp\"`) only: the single category that best describes the dominant theme. Pick \"missing_tool\" if a capability was absent, \"tool_description\" if the tool docs were unclear, \"tool_input_schema\" if input args were confusing, \"tool_output_format\" if the response was hard to consume, \"instructions_clarity\" if these MCP instructions were unclear, \"tool_correctness\" if a tool returned wrong data, \"error_message\" if an error was unhelpful, \"performance\" if latency was the issue. Omit for product, docs, or other feedback.","type": "string","enum": ["tool_correctness",@@ -416,26 +426,25 @@"performance","error_message","other"- ],- "description": "The single category that best describes the dominant theme of this feedback. Pick \"missing_tool\" if a capability was absent, \"tool_description\" if the tool docs were unclear, \"tool_input_schema\" if input args were confusing, \"tool_output_format\" if the response was hard to consume, \"instructions_clarity\" if these MCP instructions were unclear, \"tool_correctness\" if a tool returned wrong data, \"error_message\" if an error was unhelpful, \"performance\" if latency was the issue."+ ]},"task_completed": {- "type": "boolean",- "description": "Were you able to complete the user's task using PostHog MCP tools? Be honest — \"false\" is just as useful as \"true\"."+ "description": "Were you able to complete the user's task? Be honest — \"false\" is just as useful as \"true\". Most relevant when `feedback_type` is \"mcp\".",+ "type": "boolean"},"tools_used": {- "description": "The tool names you called while working on the user's task (e.g. [\"read-data-schema\", \"query-trends\"]). Helps us correlate feedback to specific tools.",+ "description": "The MCP tool names you called while working on the user's task (e.g. [\"read-data-schema\", \"query-trends\"]). Helps us correlate feedback to specific tools.","type": "array","items": {"type": "string"}},"friction_points": {- "description": "Clear, concise bullet points describing friction with the MCP server itself — what slowed you down or made you guess. Quote the exact tool name, parameter, or error text. Keep it about the MCP, not the user's task or data.",+ "description": "Clear, concise bullet points describing the friction — what was confusing, broken, slow, or missing. Quote the exact product surface, tool name, parameter, or error text where you can. Omit for purely positive feedback.","type": "string"},"suggested_improvement": {- "description": "The single most impactful, concrete change that would fix the problem you hit. Be specific (e.g. \"add a `filters` example to query-funnel's description\"). If you cannot name a specific change, do not submit feedback.",+ "description": "The single most impactful, concrete change that would address this feedback, if you can name one (e.g. \"add a `filters` example to query-funnel's description\", or \"let the replay scrubber snap to the nearest event\"). Optional — praise or an observation doesn't need one.","type": "string"},"user_request": {@@ -443,11 +452,11 @@"type": "string"},"details": {- "description": "Any additional context about the MCP server that doesn't fit the other fields. Keep it to clear, concise bullet points.",+ "description": "Any additional context that doesn't fit the other fields. Keep it to clear, concise bullet points.","type": "string"}},- "required": ["summary", "sentiment", "category", "task_completed"]+ "required": ["summary", "feedback_type", "sentiment"]},"InsightQueryInputSchema": {"type": "object",diff --git a/services/mcp/src/schema/tool-inputs.ts b/services/mcp/src/schema/tool-inputs.tsindex 9ccf457e9123..52c022b848e9 100644--- a/services/mcp/src/schema/tool-inputs.ts+++ b/services/mcp/src/schema/tool-inputs.ts@@ -177,12 +177,23 @@ export const FeedbackSubmitSchema = z.object({.string().min(1).describe(- 'A one-sentence headline naming the problem (e.g. "query-trends descriptions made it hard to choose between trends and funnels"). Only submit when something went wrong or was missing — never for positive or "everything worked" feedback.'+ 'A one-sentence headline capturing the feedback (e.g. "session replay scrubber jumps backwards when you click the timeline", "query-trends descriptions made it hard to choose between trends and funnels", or "the new SQL editor autocomplete is excellent").'+ ),+ feedback_type: z+ .enum(['product', 'mcp', 'docs', 'other'])+ .describe(+ 'What this feedback is about. "product" = any PostHog product or feature (insights, session replay, feature flags, the data warehouse, web analytics, error tracking, etc.). "mcp" = this MCP server itself — a tool, its input schema, response format, an error, or these instructions. "docs" = PostHog documentation. "other" = anything that doesn\'t fit the above.'),sentiment: z- .enum(['negative', 'mixed'])+ .enum(['positive', 'neutral', 'negative', 'mixed'])+ .describe(+ 'The overall tone. Use "negative" for something broken or blocking, "mixed" for mostly-fine-but-with-a-concrete-problem, "neutral" for a suggestion or feature request with no strong sentiment, and "positive" for praise or something that worked well. All sentiments are welcome — positive feedback is encouraged, not just problems.'+ ),+ product_area: z+ .string()+ .optional().describe(- 'How much the MCP server got in your way for this task. Use "negative" if it blocked you, "mixed" if it mostly worked but had a concrete problem worth fixing. Do not submit purely positive feedback — only report problems.'+ 'The PostHog product or area this is about, in free text (e.g. "session replay", "insights", "data warehouse", "feature flags", "docs"). Most useful for product feedback; for MCP feedback the tool name belongs in `details`/`friction_points` instead.'),category: z.enum([@@ -196,31 +207,33 @@ export const FeedbackSubmitSchema = z.object({'error_message','other',])+ .optional().describe(- 'The single category that best describes the dominant theme of this feedback. Pick "missing_tool" if a capability was absent, "tool_description" if the tool docs were unclear, "tool_input_schema" if input args were confusing, "tool_output_format" if the response was hard to consume, "instructions_clarity" if these MCP instructions were unclear, "tool_correctness" if a tool returned wrong data, "error_message" if an error was unhelpful, "performance" if latency was the issue.'+ 'For MCP feedback (`feedback_type: "mcp"`) only: the single category that best describes the dominant theme. Pick "missing_tool" if a capability was absent, "tool_description" if the tool docs were unclear, "tool_input_schema" if input args were confusing, "tool_output_format" if the response was hard to consume, "instructions_clarity" if these MCP instructions were unclear, "tool_correctness" if a tool returned wrong data, "error_message" if an error was unhelpful, "performance" if latency was the issue. Omit for product, docs, or other feedback.'),task_completed: z.boolean()+ .optional().describe(- 'Were you able to complete the user\'s task using PostHog MCP tools? Be honest — "false" is just as useful as "true".'+ 'Were you able to complete the user\'s task? Be honest — "false" is just as useful as "true". Most relevant when `feedback_type` is "mcp".'),tools_used: z.array(z.string()).optional().describe(- 'The tool names you called while working on the user\'s task (e.g. ["read-data-schema", "query-trends"]). Helps us correlate feedback to specific tools.'+ 'The MCP tool names you called while working on the user\'s task (e.g. ["read-data-schema", "query-trends"]). Helps us correlate feedback to specific tools.'),friction_points: z.string().optional().describe(- "Clear, concise bullet points describing friction with the MCP server itself — what slowed you down or made you guess. Quote the exact tool name, parameter, or error text. Keep it about the MCP, not the user's task or data."+ 'Clear, concise bullet points describing the friction — what was confusing, broken, slow, or missing. Quote the exact product surface, tool name, parameter, or error text where you can. Omit for purely positive feedback.'),suggested_improvement: z.string().optional().describe(- 'The single most impactful, concrete change that would fix the problem you hit. Be specific (e.g. "add a `filters` example to query-funnel\'s description"). If you cannot name a specific change, do not submit feedback.'+ 'The single most impactful, concrete change that would address this feedback, if you can name one (e.g. "add a `filters` example to query-funnel\'s description", or "let the replay scrubber snap to the nearest event"). Optional — praise or an observation doesn\'t need one.'),user_request: z.string()@@ -232,7 +245,7 @@ export const FeedbackSubmitSchema = z.object({.string().optional().describe(- "Any additional context about the MCP server that doesn't fit the other fields. Keep it to clear, concise bullet points."+ "Any additional context that doesn't fit the other fields. Keep it to clear, concise bullet points."),})diff --git a/services/mcp/src/templates/sections/agent-feedback.md b/services/mcp/src/templates/sections/agent-feedback.mdindex 6ac238d11a5b..2d9a50879212 100644--- a/services/mcp/src/templates/sections/agent-feedback.md+++ b/services/mcp/src/templates/sections/agent-feedback.md@@ -1,19 +1,18 @@-### Sharing feedback on this MCP server+### Sharing feedback on PostHog-The `agent-feedback` tool is the primary signal we use to fix problems with this MCP server — its tool descriptions, input schemas, response formats, and these instructions. Keep every report strictly about the MCP server itself, not about the user's task, their data, or your findings.+The `agent-feedback` tool is a direct channel to the PostHog team for feedback about **anything PostHog** — a product or feature you (or the user) hit a rough edge with, this MCP server itself, the docs, or a capability that's missing. Use it whenever you or the user run into something worth telling the PostHog team, on any surface.-**Only call `agent-feedback` when something went wrong or was missing with the MCP — report problems, not praise.** The feedback must be constructive and actionable: each report should point at a concrete defect the PostHog team can fix. Skip it entirely for smooth, routine work — do **not** submit positive or "everything worked fine" reports, as they are noise we cannot act on.+Set `feedback_type` to route it:-Keep it short: give a one-sentence `summary`, then write the detail fields (`friction_points`, `suggested_improvement`, `details`) as clear, concise bullet points, quoting the exact tool name, parameter, or error text. Report only when one of these actually happened:+- `product` — any PostHog product or feature: insights, session replay, feature flags, the data warehouse, web analytics, error tracking, experiments, etc. Put the area in `product_area` (e.g. "session replay").+- `mcp` — this MCP server itself: an unclear tool description, a confusing input schema, a hard-to-consume response, wrong results, an unhelpful error, a missing tool, or these instructions. Set `category` for MCP feedback.+- `docs` — PostHog documentation.+- `other` — anything that doesn't fit the above.-- A tool description was unclear or ambiguous and you had to guess.-- An input schema was confusing or surprising.-- A response format was hard to consume or had too much / too little data.-- A tool returned wrong, incomplete, or unexpected results.-- An error message was unhelpful or didn't explain how to recover.-- A capability was missing entirely and you had to work around it.-- These instructions led you down the wrong path.+**All sentiments are welcome** — set `sentiment` to `positive`, `neutral`, `negative`, or `mixed`. Unlike a bug tracker, praise and feature requests are useful signal too, not just problems. Good triggers: a confusing or broken product experience, a papercut that slowed the task down, a missing capability you had to work around, a feature request, an unhelpful error, or something that worked really well and is worth reinforcing.-Every report must include a concrete `suggested_improvement` — if you can't name a specific change the team should make, don't submit. Use `task_completed: false` when you couldn't finish the user's request — that signal is especially valuable. Do not include user PII or sensitive query content in any field.+Keep it short and actionable: a one-sentence `summary`, then the detail fields (`friction_points`, `suggested_improvement`, `details`) as clear, concise bullet points, quoting the exact product surface, tool name, parameter, or error text where you can. Include a concrete `suggested_improvement` whenever you can name one — for negative or mixed feedback that's the most valuable part. Use `task_completed: false` when you couldn't finish the user's request. Do not include user PII or sensitive query content in any field.-Submitting feedback is **not** a way to end your turn or skip work. It is a side report to the PostHog team about the MCP server — call it once at the end of a task when warranted, then keep going and finish the user's task with the other tools.+The user can also ask you to send feedback directly — e.g. "make a PostHog feedback for this, it's broken." When they do, capture their point faithfully and submit it.++Submitting feedback is **not** a way to end your turn or skip work. It's a side report to the PostHog team — call it when warranted, then keep going and finish the user's task with the other tools.diff --git a/services/mcp/src/tools/feedback/submit.ts b/services/mcp/src/tools/feedback/submit.tsindex c215365aebdc..446086d315eb 100644--- a/services/mcp/src/tools/feedback/submit.ts+++ b/services/mcp/src/tools/feedback/submit.ts@@ -11,8 +11,8 @@ type Params = z.infer<typeof schema>type Result = {received: booleansummary: string+ feedback_type: Params['feedback_type']sentiment: Params['sentiment']- category: Params['category']message: string}@@ -32,7 +32,9 @@ export const submitFeedbackHandler: ToolBase<typeof schema, Result>['handler'] =try {await context.trackEvent(AnalyticsEvent.MCP_FEEDBACK_SUBMITTED, {feedback_summary: params.summary,+ feedback_type: params.feedback_type,feedback_sentiment: params.sentiment,+ feedback_product_area: params.product_area,feedback_category: params.category,feedback_task_completed: params.task_completed,feedback_tools_used: params.tools_used,@@ -48,8 +50,8 @@ export const submitFeedbackHandler: ToolBase<typeof schema, Result>['handler'] =return {received: true,summary: params.summary,+ feedback_type: params.feedback_type,sentiment: params.sentiment,- category: params.category,message: RESPONSE_MESSAGE,}}diff --git a/services/mcp/tests/unit/__snapshots__/instructions/exec-command-reference-full.txt b/services/mcp/tests/unit/__snapshots__/instructions/exec-command-reference-full.txtindex 31d0c96a52a7..d81d6b5deca3 100644--- a/services/mcp/tests/unit/__snapshots__/instructions/exec-command-reference-full.txt+++ b/services/mcp/tests/unit/__snapshots__/instructions/exec-command-reference-full.txt@@ -350,25 +350,24 @@ Choose the link source in this order:- Project-scoped paths → Base URL + `/project/:id`: `/settings/<section-id>` (hyphenated, e.g. `/settings/environment-replay`, `/settings/user-api-keys`), `/data-management/events`, `/data-management/properties`.- Org-/account-level paths → Base URL only (no `/project/:id`): first segment `organization`, `me`, `account`, or `instance` — e.g. billing is `/organization/billing`.-### Sharing feedback on this MCP server+### Sharing feedback on PostHog-The `agent-feedback` tool is the primary signal we use to fix problems with this MCP server — its tool descriptions, input schemas, response formats, and these instructions. Keep every report strictly about the MCP server itself, not about the user's task, their data, or your findings.+The `agent-feedback` tool is a direct channel to the PostHog team for feedback about **anything PostHog** — a product or feature you (or the user) hit a rough edge with, this MCP server itself, the docs, or a capability that's missing. Use it whenever you or the user run into something worth telling the PostHog team, on any surface.-**Only call `agent-feedback` when something went wrong or was missing with the MCP — report problems, not praise.** The feedback must be constructive and actionable: each report should point at a concrete defect the PostHog team can fix. Skip it entirely for smooth, routine work — do **not** submit positive or "everything worked fine" reports, as they are noise we cannot act on.+Set `feedback_type` to route it:-Keep it short: give a one-sentence `summary`, then write the detail fields (`friction_points`, `suggested_improvement`, `details`) as clear, concise bullet points, quoting the exact tool name, parameter, or error text. Report only when one of these actually happened:+- `product` — any PostHog product or feature: insights, session replay, feature flags, the data warehouse, web analytics, error tracking, experiments, etc. Put the area in `product_area` (e.g. "session replay").+- `mcp` — this MCP server itself: an unclear tool description, a confusing input schema, a hard-to-consume response, wrong results, an unhelpful error, a missing tool, or these instructions. Set `category` for MCP feedback.+- `docs` — PostHog documentation.+- `other` — anything that doesn't fit the above.-- A tool description was unclear or ambiguous and you had to guess.-- An input schema was confusing or surprising.-- A response format was hard to consume or had too much / too little data.-- A tool returned wrong, incomplete, or unexpected results.-- An error message was unhelpful or didn't explain how to recover.-- A capability was missing entirely and you had to work around it.-- These instructions led you down the wrong path.+**All sentiments are welcome** — set `sentiment` to `positive`, `neutral`, `negative`, or `mixed`. Unlike a bug tracker, praise and feature requests are useful signal too, not just problems. Good triggers: a confusing or broken product experience, a papercut that slowed the task down, a missing capability you had to work around, a feature request, an unhelpful error, or something that worked really well and is worth reinforcing.-Every report must include a concrete `suggested_improvement` — if you can't name a specific change the team should make, don't submit. Use `task_completed: false` when you couldn't finish the user's request — that signal is especially valuable. Do not include user PII or sensitive query content in any field.+Keep it short and actionable: a one-sentence `summary`, then the detail fields (`friction_points`, `suggested_improvement`, `details`) as clear, concise bullet points, quoting the exact product surface, tool name, parameter, or error text where you can. Include a concrete `suggested_improvement` whenever you can name one — for negative or mixed feedback that's the most valuable part. Use `task_completed: false` when you couldn't finish the user's request. Do not include user PII or sensitive query content in any field.-Submitting feedback is **not** a way to end your turn or skip work. It is a side report to the PostHog team about the MCP server — call it once at the end of a task when warranted, then keep going and finish the user's task with the other tools.+The user can also ask you to send feedback directly — e.g. "make a PostHog feedback for this, it's broken." When they do, capture their point faithfully and submit it.++Submitting feedback is **not** a way to end your turn or skip work. It's a side report to the PostHog team — call it when warranted, then keep going and finish the user's task with the other tools.### Examplesdiff --git a/services/mcp/tests/unit/__snapshots__/instructions/tools-instructions.txt b/services/mcp/tests/unit/__snapshots__/instructions/tools-instructions.txtindex 05d203f845cc..0632c8f362ea 100644--- a/services/mcp/tests/unit/__snapshots__/instructions/tools-instructions.txt+++ b/services/mcp/tests/unit/__snapshots__/instructions/tools-instructions.txt@@ -214,25 +214,24 @@ Choose the link source in this order:- Project-scoped paths → Base URL + `/project/:id`: `/settings/<section-id>` (hyphenated, e.g. `/settings/environment-replay`, `/settings/user-api-keys`), `/data-management/events`, `/data-management/properties`.- Org-/account-level paths → Base URL only (no `/project/:id`): first segment `organization`, `me`, `account`, or `instance` — e.g. billing is `/organization/billing`.-### Sharing feedback on this MCP server+### Sharing feedback on PostHog-The `agent-feedback` tool is the primary signal we use to fix problems with this MCP server — its tool descriptions, input schemas, response formats, and these instructions. Keep every report strictly about the MCP server itself, not about the user's task, their data, or your findings.+The `agent-feedback` tool is a direct channel to the PostHog team for feedback about **anything PostHog** — a product or feature you (or the user) hit a rough edge with, this MCP server itself, the docs, or a capability that's missing. Use it whenever you or the user run into something worth telling the PostHog team, on any surface.-**Only call `agent-feedback` when something went wrong or was missing with the MCP — report problems, not praise.** The feedback must be constructive and actionable: each report should point at a concrete defect the PostHog team can fix. Skip it entirely for smooth, routine work — do **not** submit positive or "everything worked fine" reports, as they are noise we cannot act on.+Set `feedback_type` to route it:-Keep it short: give a one-sentence `summary`, then write the detail fields (`friction_points`, `suggested_improvement`, `details`) as clear, concise bullet points, quoting the exact tool name, parameter, or error text. Report only when one of these actually happened:+- `product` — any PostHog product or feature: insights, session replay, feature flags, the data warehouse, web analytics, error tracking, experiments, etc. Put the area in `product_area` (e.g. "session replay").+- `mcp` — this MCP server itself: an unclear tool description, a confusing input schema, a hard-to-consume response, wrong results, an unhelpful error, a missing tool, or these instructions. Set `category` for MCP feedback.+- `docs` — PostHog documentation.+- `other` — anything that doesn't fit the above.-- A tool description was unclear or ambiguous and you had to guess.-- An input schema was confusing or surprising.-- A response format was hard to consume or had too much / too little data.-- A tool returned wrong, incomplete, or unexpected results.-- An error message was unhelpful or didn't explain how to recover.-- A capability was missing entirely and you had to work around it.-- These instructions led you down the wrong path.+**All sentiments are welcome** — set `sentiment` to `positive`, `neutral`, `negative`, or `mixed`. Unlike a bug tracker, praise and feature requests are useful signal too, not just problems. Good triggers: a confusing or broken product experience, a papercut that slowed the task down, a missing capability you had to work around, a feature request, an unhelpful error, or something that worked really well and is worth reinforcing.-Every report must include a concrete `suggested_improvement` — if you can't name a specific change the team should make, don't submit. Use `task_completed: false` when you couldn't finish the user's request — that signal is especially valuable. Do not include user PII or sensitive query content in any field.+Keep it short and actionable: a one-sentence `summary`, then the detail fields (`friction_points`, `suggested_improvement`, `details`) as clear, concise bullet points, quoting the exact product surface, tool name, parameter, or error text where you can. Include a concrete `suggested_improvement` whenever you can name one — for negative or mixed feedback that's the most valuable part. Use `task_completed: false` when you couldn't finish the user's request. Do not include user PII or sensitive query content in any field.-Submitting feedback is **not** a way to end your turn or skip work. It is a side report to the PostHog team about the MCP server — call it once at the end of a task when warranted, then keep going and finish the user's task with the other tools.+The user can also ask you to send feedback directly — e.g. "make a PostHog feedback for this, it's broken." When they do, capture their point faithfully and submit it.++Submitting feedback is **not** a way to end your turn or skip work. It's a side report to the PostHog team — call it when warranted, then keep going and finish the user's task with the other tools.### Examplesdiff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-feedback.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-feedback.jsonindex 136108bfade0..fcc5e32fb9c6 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-feedback.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/agent-feedback.json@@ -2,7 +2,7 @@"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {"category": {- "description": "The single category that best describes the dominant theme of this feedback. Pick \"missing_tool\" if a capability was absent, \"tool_description\" if the tool docs were unclear, \"tool_input_schema\" if input args were confusing, \"tool_output_format\" if the response was hard to consume, \"instructions_clarity\" if these MCP instructions were unclear, \"tool_correctness\" if a tool returned wrong data, \"error_message\" if an error was unhelpful, \"performance\" if latency was the issue.",+ "description": "For MCP feedback (`feedback_type: \"mcp\"`) only: the single category that best describes the dominant theme. Pick \"missing_tool\" if a capability was absent, \"tool_description\" if the tool docs were unclear, \"tool_input_schema\" if input args were confusing, \"tool_output_format\" if the response was hard to consume, \"instructions_clarity\" if these MCP instructions were unclear, \"tool_correctness\" if a tool returned wrong data, \"error_message\" if an error was unhelpful, \"performance\" if latency was the issue. Omit for product, docs, or other feedback.","enum": ["tool_correctness","tool_description",@@ -17,33 +17,42 @@"type": "string"},"details": {- "description": "Any additional context about the MCP server that doesn't fit the other fields. Keep it to clear, concise bullet points.",+ "description": "Any additional context that doesn't fit the other fields. Keep it to clear, concise bullet points.",+ "type": "string"+ },+ "feedback_type": {+ "description": "What this feedback is about. \"product\" = any PostHog product or feature (insights, session replay, feature flags, the data warehouse, web analytics, error tracking, etc.). \"mcp\" = this MCP server itself — a tool, its input schema, response format, an error, or these instructions. \"docs\" = PostHog documentation. \"other\" = anything that doesn't fit the above.",+ "enum": ["product", "mcp", "docs", "other"],"type": "string"},"friction_points": {- "description": "Clear, concise bullet points describing friction with the MCP server itself — what slowed you down or made you guess. Quote the exact tool name, parameter, or error text. Keep it about the MCP, not the user's task or data.",+ "description": "Clear, concise bullet points describing the friction — what was confusing, broken, slow, or missing. Quote the exact product surface, tool name, parameter, or error text where you can. Omit for purely positive feedback.",+ "type": "string"+ },+ "product_area": {+ "description": "The PostHog product or area this is about, in free text (e.g. \"session replay\", \"insights\", \"data warehouse\", \"feature flags\", \"docs\"). Most useful for product feedback; for MCP feedback the tool name belongs in `details`/`friction_points` instead.","type": "string"},"sentiment": {- "description": "How much the MCP server got in your way for this task. Use \"negative\" if it blocked you, \"mixed\" if it mostly worked but had a concrete problem worth fixing. Do not submit purely positive feedback — only report problems.",- "enum": ["negative", "mixed"],+ "description": "The overall tone. Use \"negative\" for something broken or blocking, \"mixed\" for mostly-fine-but-with-a-concrete-problem, \"neutral\" for a suggestion or feature request with no strong sentiment, and \"positive\" for praise or something that worked well. All sentiments are welcome — positive feedback is encouraged, not just problems.",+ "enum": ["positive", "neutral", "negative", "mixed"],"type": "string"},"suggested_improvement": {- "description": "The single most impactful, concrete change that would fix the problem you hit. Be specific (e.g. \"add a `filters` example to query-funnel's description\"). If you cannot name a specific change, do not submit feedback.",+ "description": "The single most impactful, concrete change that would address this feedback, if you can name one (e.g. \"add a `filters` example to query-funnel's description\", or \"let the replay scrubber snap to the nearest event\"). Optional — praise or an observation doesn't need one.","type": "string"},"summary": {- "description": "A one-sentence headline naming the problem (e.g. \"query-trends descriptions made it hard to choose between trends and funnels\"). Only submit when something went wrong or was missing — never for positive or \"everything worked\" feedback.",+ "description": "A one-sentence headline capturing the feedback (e.g. \"session replay scrubber jumps backwards when you click the timeline\", \"query-trends descriptions made it hard to choose between trends and funnels\", or \"the new SQL editor autocomplete is excellent\").","minLength": 1,"type": "string"},"task_completed": {- "description": "Were you able to complete the user's task using PostHog MCP tools? Be honest — \"false\" is just as useful as \"true\".",+ "description": "Were you able to complete the user's task? Be honest — \"false\" is just as useful as \"true\". Most relevant when `feedback_type` is \"mcp\".","type": "boolean"},"tools_used": {- "description": "The tool names you called while working on the user's task (e.g. [\"read-data-schema\", \"query-trends\"]). Helps us correlate feedback to specific tools.",+ "description": "The MCP tool names you called while working on the user's task (e.g. [\"read-data-schema\", \"query-trends\"]). Helps us correlate feedback to specific tools.","items": {"type": "string"},@@ -54,6 +63,6 @@"type": "string"}},- "required": ["summary", "sentiment", "category", "task_completed"],+ "required": ["summary", "feedback_type", "sentiment"],"type": "object"}diff --git a/services/mcp/tests/unit/instructions-formatter.test.ts b/services/mcp/tests/unit/instructions-formatter.test.tsindex 900c3e1c48e6..721d9df39a71 100644--- a/services/mcp/tests/unit/instructions-formatter.test.ts+++ b/services/mcp/tests/unit/instructions-formatter.test.ts@@ -85,11 +85,11 @@ describe('InstructionsFormatter', () => {it('includes the agent-feedback section only when the mcp-feedback-tool flag is on', () => {const formatter = new InstructionsFormatter()const withFeedback = formatter.buildToolsInstructions(fullCtx)- expect(withFeedback).toContain('### Sharing feedback on this MCP server')+ expect(withFeedback).toContain('### Sharing feedback on PostHog')for (const featureFlags of [undefined, { 'mcp-feedback-tool': false }, {}]) {const result = formatter.buildToolsInstructions({ ...fullCtx, featureFlags })- expect(result).not.toContain('### Sharing feedback on this MCP server')+ expect(result).not.toContain('### Sharing feedback on PostHog')}})})@@ -194,13 +194,13 @@ describe('InstructionsFormatter', () => {const formatter = new InstructionsFormatter()for (const stripEnvContext of [true, false]) {const withFeedback = formatter.buildExecCommandReference(fullCtx, { stripEnvContext })- expect(withFeedback).toContain('### Sharing feedback on this MCP server')+ expect(withFeedback).toContain('### Sharing feedback on PostHog')const withoutFeedback = formatter.buildExecCommandReference({ ...fullCtx, featureFlags: { 'mcp-feedback-tool': false } },{ stripEnvContext })- expect(withoutFeedback).not.toContain('### Sharing feedback on this MCP server')+ expect(withoutFeedback).not.toContain('### Sharing feedback on PostHog')}})