: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
chore(mcp): roll out agent-feedback tool to everyone (#70439)
Georgiy Tarasov237bab5ec86c
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 6a321ee6f8f1..56368519d9d8 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -932,7 +932,6 @@"title": "Submit PostHog feedback","required_scopes": [],"always_available": true,- "feature_flag": "mcp-feedback-tool","annotations": {"destructiveHint": false,"idempotentHint": false,diff --git a/services/mcp/schema/tool-definitions.json b/services/mcp/schema/tool-definitions.jsonindex d8d9b3632a63..b458947a585a 100644--- a/services/mcp/schema/tool-definitions.json+++ b/services/mcp/schema/tool-definitions.json@@ -21,7 +21,6 @@"title": "Submit PostHog feedback","required_scopes": [],"always_available": true,- "feature_flag": "mcp-feedback-tool","annotations": {"destructiveHint": false,"idempotentHint": false,diff --git a/services/mcp/src/hono/instructions.ts b/services/mcp/src/hono/instructions.tsindex 2ae707856810..c8771738db1e 100644--- a/services/mcp/src/hono/instructions.ts+++ b/services/mcp/src/hono/instructions.ts@@ -58,7 +58,6 @@ export class InstructionsBuilder {...(def.system_prompt_hint ? { systemPromptHint: def.system_prompt_hint } : {}),} as QueryToolInfo}),- featureFlags: state.toolFeatureFlags,renderUiEnabled: state.renderUiEnabled,metadata: state.metadata,groupTypes: state.groupTypes,diff --git a/services/mcp/src/lib/instructions-formatter.ts b/services/mcp/src/lib/instructions-formatter.tsindex 0c9e3d38afee..27ba23b55714 100644--- a/services/mcp/src/lib/instructions-formatter.ts+++ b/services/mcp/src/lib/instructions-formatter.ts@@ -7,7 +7,6 @@ import {type QueryToolInfo,type ToolInfo,} from '@/lib/instructions'-import type { EvaluatedFlags } from '@/lib/posthog/flags'import { formatPrompt } from '@/lib/utils'import AGENT_FEEDBACK from '@/templates/sections/agent-feedback.md'import BASIC_FUNCTIONALITY from '@/templates/sections/basic-functionality.md'@@ -33,9 +32,6 @@ export interface InstructionsContext {metadata?: string | undefinedtools?: ToolInfo[] | undefinedqueryTools?: QueryToolInfo[] | undefined- /** Resolved tool feature flags from `resolveToolFeatureFlags`. Used to gate- * prompt sections whose corresponding tool is flag-gated. */- featureFlags?: EvaluatedFlags | undefined/** Whether `render-ui` is actually available to this client (i.e. the client is* an MCP Apps host). Gates the CLI rendering section so it never reaches clients —* like Claude Code — that can't mount the iframe. */@@ -59,7 +55,7 @@ export class InstructionsFormatter {SCHEMA_WORKFLOW,ENV_CONTEXT,URL_PATTERNS,- ...(this.agentFeedbackEnabled(ctx.featureFlags) ? [AGENT_FEEDBACK] : []),+ AGENT_FEEDBACK,EXAMPLES,],ctx,@@ -114,14 +110,13 @@ export class InstructionsFormatter {SCHEMA_WORKFLOW,ENV_CONTEXT,URL_PATTERNS,- ...(this.agentFeedbackEnabled(ctx.featureFlags) ? [AGENT_FEEDBACK] : []),+ AGENT_FEEDBACK,EXAMPLES,]const renderCtx: InstructionsContext = opts.stripEnvContext? {guidelines: ctx.guidelines,queryTools: ctx.queryTools,- featureFlags: ctx.featureFlags,...(opts.keepEnvContext ? { metadata: ctx.metadata, groupTypes: ctx.groupTypes } : {}),}: { ...ctx, tools: undefined }@@ -132,13 +127,6 @@ export class InstructionsFormatter {return this.compose(sections, renderCtx, { compact: false })}- /** The agent-feedback section is only useful when the `agent-feedback` tool- * is reachable, which is governed by the `mcp-feedback-tool` flag evaluated- * in `resolveToolFeatureFlags`. */- private agentFeedbackEnabled(featureFlags: EvaluatedFlags | undefined): boolean {- return featureFlags?.['mcp-feedback-tool'] === true- }-private compose(sections: string[], ctx: InstructionsContext, opts: { compact: boolean }): string {const renderToolDomains = opts.compact ? buildToolDomainsCompact : buildToolDomainsBlock// `{query_tools}` only appears in non-compact sections (the exec commanddiff --git a/services/mcp/tests/unit/instructions-formatter-snapshot.test.ts b/services/mcp/tests/unit/instructions-formatter-snapshot.test.tsindex 08c54f8e4d13..72bd7bb21490 100644--- a/services/mcp/tests/unit/instructions-formatter-snapshot.test.ts+++ b/services/mcp/tests/unit/instructions-formatter-snapshot.test.ts@@ -46,7 +46,6 @@ const STATIC_CTX: InstructionsContext = {metadata: STATIC_METADATA,tools: STATIC_TOOLS,queryTools: STATIC_QUERY_TOOLS,- featureFlags: { 'mcp-feedback-tool': true },renderUiEnabled: true,}@@ -142,7 +141,7 @@ describe('InstructionsFormatter prompt snapshots', () => {const state = {allTools: Object.keys(getToolDefinitions()).map((name) => ({ name })),clientProfile: new MCPClientProfile({ vendorClient: 'ClaudeAI', userAgent: 'Claude-User' }),- toolFeatureFlags: { 'mcp-feedback-tool': true },+ toolFeatureFlags: {},renderUiEnabled: true,metadata: worstCaseMetadata,groupTypes: worstCaseGroupTypes,diff --git a/services/mcp/tests/unit/instructions-formatter.test.ts b/services/mcp/tests/unit/instructions-formatter.test.tsindex d44d2abf5270..0e90033a2d68 100644--- a/services/mcp/tests/unit/instructions-formatter.test.ts+++ b/services/mcp/tests/unit/instructions-formatter.test.ts@@ -34,7 +34,6 @@ const fullCtx: InstructionsContext = {metadata: realisticMetadata,tools: realisticTools,queryTools: realisticQueryTools,- featureFlags: { 'mcp-feedback-tool': true },renderUiEnabled: true,}@@ -82,15 +81,12 @@ describe('InstructionsFormatter', () => {expect(result).not.toContain('{metadata}')})- it('includes the agent-feedback section only when the mcp-feedback-tool flag is on', () => {+ it('always includes the agent-feedback section', () => {const formatter = new InstructionsFormatter()- const withFeedback = formatter.buildToolsInstructions(fullCtx)- 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 PostHog')- }+ expect(formatter.buildToolsInstructions(fullCtx)).toContain('### Sharing feedback on PostHog')+ expect(formatter.buildToolsInstructions({ guidelines: 'rules' })).toContain(+ '### Sharing feedback on PostHog'+ )})})@@ -205,17 +201,11 @@ describe('InstructionsFormatter', () => {expect(result).toContain('Defined group types: organization')})- it('includes the agent-feedback section only when the mcp-feedback-tool flag is on', () => {+ it('always includes the agent-feedback section', () => {const formatter = new InstructionsFormatter()for (const stripEnvContext of [true, false]) {const withFeedback = formatter.buildExecCommandReference(fullCtx, { stripEnvContext })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 PostHog')}})diff --git a/services/mcp/tests/unit/tool-filtering.test.ts b/services/mcp/tests/unit/tool-filtering.test.tsindex 78821a1b5ab9..9165fc0d127f 100644--- a/services/mcp/tests/unit/tool-filtering.test.ts+++ b/services/mcp/tests/unit/tool-filtering.test.ts@@ -140,16 +140,14 @@ describe('Tool Filtering - Tools Allowlist', () => {expect(withEmptyTools).toEqual(allTools)})- it('should return only specified tools (plus always_available tools when enabled)', () => {+ it('should return only specified tools (plus always_available tools)', () => {const tools = getToolsForFeatures({tools: ['dashboard-get', 'dashboard-create'],- featureFlags: { 'mcp-feedback-tool': true },})expect(tools).toContain('dashboard-get')expect(tools).toContain('dashboard-create')- // always_available tools are included alongside the allowlist regardless of order- // (when their gating feature flag is enabled).+ // always_available tools are included alongside the allowlist regardless of order.const alwaysAvailableTools = collectAlwaysAvailableToolNames()expect(tools).toContain('agent-feedback')@@ -163,7 +161,6 @@ describe('Tool Filtering - Tools Allowlist', () => {it('should return only always_available tools for nonexistent tool names', () => {const tools = getToolsForFeatures({tools: ['nonexistent-tool'],- featureFlags: { 'mcp-feedback-tool': true },})const alwaysAvailableTools = collectAlwaysAvailableToolNames()@@ -175,19 +172,15 @@ describe('Tool Filtering - Tools Allowlist', () => {it('should always include agent-feedback even when feature filter matches no tools', () => {const tools = getToolsForFeatures({features: ['nonexistent-feature'],- featureFlags: { 'mcp-feedback-tool': true },})expect(tools).toContain('agent-feedback')})- it('should hide agent-feedback when its gating feature flag is off', () => {- // Flag explicitly off — tool is hidden even though it's always_available.- const toolsWithFlagOff = getToolsForFeatures({ featureFlags: { 'mcp-feedback-tool': false } })- expect(toolsWithFlagOff).not.toContain('agent-feedback')-- // No flags evaluated at all — also hidden (default behavior is `enable`).- const toolsWithoutFlags = getToolsForFeatures({})- expect(toolsWithoutFlags).not.toContain('agent-feedback')+ it('should include agent-feedback regardless of feature flags', () => {+ // agent-feedback is always_available and no longer flag-gated — it is+ // present whether or not any feature flags are evaluated.+ expect(getToolsForFeatures({})).toContain('agent-feedback')+ expect(getToolsForFeatures({ featureFlags: {} })).toContain('agent-feedback')})it('should union with features (OR) when both are provided', () => {@@ -327,7 +320,7 @@ describe('Tool Filtering - API Scopes', () => {it('should return only tools with no required scopes when user has no matching scopes', async () => {const context = createMockContext(['some:unknown'])- const tools = await getToolsFromContext(context, { featureFlags: { 'mcp-feedback-tool': true } })+ const tools = await getToolsFromContext(context)const toolNames = tools.map((t) => t.name)// Only tools with no required scopes (or that bypass scope checks) should be available.@@ -338,7 +331,7 @@ describe('Tool Filtering - API Scopes', () => {it('should return only tools with no required scopes when user has empty scopes', async () => {const context = createMockContext([])- const tools = await getToolsFromContext(context, { featureFlags: { 'mcp-feedback-tool': true } })+ const tools = await getToolsFromContext(context)const toolNames = tools.map((t) => t.name)expect(toolNames).toContain('debug-mcp-ui-apps')@@ -734,7 +727,6 @@ describe('Tool Filtering - Feature Flags', () => {it('getRequiredFeatureFlags should return flags used by current definitions', () => {const flags = getRequiredFeatureFlags()- // Includes the gating flag for agent-feedback alongside the other gated tools.expect(flags).toEqual(expect.arrayContaining(['agent-platform',@@ -743,7 +735,6 @@ describe('Tool Filtering - Feature Flags', () => {'replay-video-based-summarization','tracing','visual-review',- 'mcp-feedback-tool','user-interviews','customer-analytics-csp','notebooks-collaboration',@@ -760,7 +751,7 @@ describe('Tool Filtering - Feature Flags', () => {'engineering-analytics',]))- expect(flags).toHaveLength(21)+ expect(flags).toHaveLength(20)})// Exercise the real predicate (toolPassesFlagGate) over hand-rolled entriesdiff --git a/services/mcp/tests/unit/tool-schema-snapshots.test.ts b/services/mcp/tests/unit/tool-schema-snapshots.test.tsindex fb9c69026879..b6fc989e36e6 100644--- a/services/mcp/tests/unit/tool-schema-snapshots.test.ts+++ b/services/mcp/tests/unit/tool-schema-snapshots.test.ts@@ -84,10 +84,10 @@ describe('Tool schema snapshots', () => {it('snapshots runtime tool schemas', async () => {const shouldUpdateSnapshots = isSnapshotUpdateAll()const root = path.resolve(__dirname, '__snapshots__', 'tool-schemas')- // Enable flag-gated tools we snapshot here: agent-feedback, tracing (APM spans), tasks,+ // Enable flag-gated tools we snapshot here: tracing (APM spans), tasks,// dashboard-widgets. Other flag-gated tools (logs-alerts, visual-review, etc.) stay off to keep the surface stable.+ // agent-feedback is always_available and no longer flag-gated, so it appears regardless.const featureFlags = {- 'mcp-feedback-tool': true,tracing: true,tasks: true,'dashboard-widgets': true,